Skip to content

Instantly share code, notes, and snippets.

@ducmeit1
Created July 15, 2019 08:09
Show Gist options
  • Save ducmeit1/3544487c9b08f55414320e75371e4b3b to your computer and use it in GitHub Desktop.
Save ducmeit1/3544487c9b08f55414320e75371e4b3b to your computer and use it in GitHub Desktop.
using System.ComponentModel.DataAnnotations;
using Customer.Domain.Dtos;
using Newtonsoft.Json;
namespace Customer.Domain.Commands
{
public class CreateCustomerCommand : CommandBase<CustomerDto>
{
public CreateCustomerCommand()
{
}
[JsonConstructor]
public CreateCustomerCommand(string name, string email, string address, int age, string phoneNumber)
{
Name = name;
Email = email;
Address = address;
Age = age;
PhoneNumber = phoneNumber;
}
[JsonProperty("name")]
[Required]
[MaxLength(255)]
public string Name { get; }
[JsonProperty("email")]
[Required]
[MaxLength(255)]
[EmailAddress]
public string Email { get; }
[JsonProperty("address")]
[Required]
[MaxLength(255)]
public string Address { get; }
[JsonProperty("age")]
[Required]
public int Age { get; }
[JsonProperty("phone_number")]
[Required]
[Phone]
public string PhoneNumber { get; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment