auto.bus_api/SharedModels/DataTransferObjects/CountryDto.cs
cuqmbr 95028ed18b feat: many thing
- Database model
- Data transfer objects
- Country management controller
2022-10-10 20:34:09 +03:00

27 lines
723 B
C#

using System.ComponentModel.DataAnnotations;
namespace SharedModels.DataTransferObjects;
public class CountryDto : CreateCountryDto
{
public int Id { get; set; }
public virtual IList<StateDto> States { get; set; } = null!;
}
public class CreateCountryDto
{
[Required]
[StringLength(maximumLength: 2, MinimumLength = 2, ErrorMessage = "The Code field must be 2 characters long")]
public string Code { get; set; } = null!;
[Required]
[StringLength(maximumLength: 56, ErrorMessage = "The Name field must be shorter than 56 characters")]
public string Name { get; set; } = null!;
}
public class UpdateCountryDto : CreateCountryDto
{
[Required]
public int Id { get; set; }
}