Dto.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using VCommon.VApplication.Auditing.DataAnnotations;
  5. using VCommon.VApplication.Dto;
  6. using VCommon.VAutoMapper;
  7. using VCommonCoreExample.Entity;
  8. namespace VCommonCoreExample.AppServices.System.Users.Dto
  9. {
  10. public class UserListRequest : PagedRequest, IStringSearchFilter, IPassiveFilter
  11. {
  12. public string Search { get; set; }
  13. public bool? IsEnable { get; set; }
  14. public DateTimeRange CreateOn { get; set; }
  15. }
  16. [AutoMapFrom(typeof(User))]
  17. public class UserDto : EntityDto, IHaveName
  18. {
  19. [AutoMapJsonConvert()]
  20. public Guid[] Roles { get; set; }
  21. public string Name { get; set; }
  22. public string LoginName { get; set; }
  23. public bool IsEnable { get; set; }
  24. }
  25. public class UserListOutput : IPagedResult<UserDto>
  26. {
  27. public IReadOnlyCollection<NamedEntityDto> AvailableRoles { get; set; }
  28. public UserListOutput(int totalRecord, IReadOnlyList<UserDto> items)
  29. {
  30. TotalRecord = totalRecord;
  31. Items = items;
  32. }
  33. public int TotalRecord { get; }
  34. [SimplifyAuditingLog]
  35. public IReadOnlyList<UserDto> Items { get; }
  36. }
  37. public class UserFormPrepOutput
  38. {
  39. public UserDto Output { get; set; }
  40. public IReadOnlyCollection<NamedEntityDto> AvailableRoles { get; }
  41. public UserFormPrepOutput(IReadOnlyCollection<NamedEntityDto> availableRoles)
  42. {
  43. AvailableRoles = availableRoles;
  44. }
  45. }
  46. public class UserCreateInput
  47. {
  48. [Required]
  49. [AutoMapJsonConvert]
  50. public Guid[] Roles { get; set; }
  51. [Required]
  52. public string Name { get; set; }
  53. [Required]
  54. public string LoginName { get; set; }
  55. [Required]
  56. public string Password { get; set; }
  57. public bool IsEnable { get; set; }
  58. }
  59. public class UserUpdateInput : EntityDto
  60. {
  61. [Required]
  62. [AutoMapJsonConvert]
  63. public Guid[] Roles { get; set; }
  64. [Required]
  65. public string Name { get; set; }
  66. [Required]
  67. public string LoginName { get; set; }
  68. public string Password { get; set; }
  69. public bool IsEnable { get; set; }
  70. }
  71. }