RoleDto.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System.ComponentModel.DataAnnotations;
  2. using AutoMapper.Configuration.Annotations;
  3. using VberZero.AppService.Base.Dto;
  4. using VberZero.BaseSystem.Roles;
  5. namespace VberZero.AppService.Roles.Dto;
  6. public class RoleDto : VzEntityDto<int>
  7. {
  8. public RoleDto(Role role, bool isCheck = false)
  9. {
  10. Id = role.Id;
  11. Name = role.Name;
  12. DisplayName = role.DisplayName;
  13. NormalizedName = role.NormalizedName;
  14. Description = role.Description;
  15. UserType = role.UserType;
  16. AccountType = role.AccountType;
  17. IsCheck = isCheck;
  18. }
  19. public RoleDto()
  20. {
  21. }
  22. [Required]
  23. [StringLength(Role.MaxNameLength)]
  24. public string Name { get; set; }
  25. [Required]
  26. [StringLength(Role.MaxDisplayNameLength)]
  27. public string DisplayName { get; set; }
  28. public string NormalizedName { get; set; }
  29. [StringLength(Role.MaxDescriptionLength)]
  30. public string Description { get; set; }
  31. public VzDefinition.UserType UserType { get; set; }
  32. public VzDefinition.AccountType AccountType { get; set; }
  33. [Ignore]
  34. public bool IsCheck { get; set; }
  35. public List<string> GrantedPermissions { get; set; }
  36. }