Created
July 15, 2019 08:09
-
-
Save ducmeit1/3544487c9b08f55414320e75371e4b3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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