| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using System.Linq; |
| | | 4 | | using System.Threading.Tasks; |
| | | 5 | | using System.ComponentModel.DataAnnotations; |
| | | 6 | | using System.Runtime.Serialization; |
| | | 7 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 8 | | using SVETA.Api.Validation; |
| | | 9 | | |
| | | 10 | | namespace SVETA.Api.Data.DTO |
| | | 11 | | { |
| | | 12 | | public class ControlAccessRequestDTO |
| | | 13 | | { |
| | | 14 | | [DigitValidate(CanBeZero = false, CanBeNegative = true)] |
| | | 15 | | [Display(Name = "Идентификатор доступа")] |
| | 0 | 16 | | public long ActionId { get; set; } |
| | 0 | 17 | | public bool? Available { get; set; } |
| | | 18 | | [DigitValidate(CanBeZero = false, CanBeNegative = true)] |
| | | 19 | | [Display(Name = "Идентификатор роли")] |
| | 0 | 20 | | public long RoleId { get; set; } |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | public class ControlAccessResponseDTO |
| | | 24 | | { |
| | | 25 | | public ControlAccessResponseDTO() { } |
| | | 26 | | public ControlAccessResponseDTO(ControlAccess data) |
| | | 27 | | { |
| | | 28 | | Id = data.Id; |
| | | 29 | | Action = new ControlAccessActionDTO(data.Action); |
| | | 30 | | Available = data.Available; |
| | | 31 | | Role = new ControlAccessRoleDTO(data.Role); |
| | | 32 | | } |
| | | 33 | | public long Id { get; set; } |
| | | 34 | | [NotNullOrWhiteSpaceValidator] |
| | | 35 | | public ControlAccessActionDTO Action { get; set; } |
| | | 36 | | public bool? Available { get; set; } |
| | | 37 | | [Required] |
| | | 38 | | public ControlAccessRoleDTO Role { get; set; } |
| | | 39 | | } |
| | | 40 | | |
| | | 41 | | public class ControlAccessRoleDTO |
| | | 42 | | { |
| | | 43 | | public ControlAccessRoleDTO() { } |
| | | 44 | | public ControlAccessRoleDTO(Roles data) |
| | | 45 | | { |
| | | 46 | | Id = data.Id; |
| | | 47 | | Name = data.Name; |
| | | 48 | | Description = data.Description; |
| | | 49 | | } |
| | | 50 | | public long Id { get; set; } |
| | | 51 | | public string Name { get; set; } |
| | | 52 | | public string Description { get; set; } |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | public class ControlAccessActionDTO |
| | | 56 | | { |
| | | 57 | | public ControlAccessActionDTO() { } |
| | | 58 | | public ControlAccessActionDTO(FrontAction data) |
| | | 59 | | { |
| | | 60 | | Id = data.Id; |
| | | 61 | | Name = data.Name; |
| | | 62 | | Description = data.Description; |
| | | 63 | | } |
| | | 64 | | public long Id { get; set; } |
| | | 65 | | public string Name { get; set; } |
| | | 66 | | public string Description { get; set; } |
| | | 67 | | } |
| | | 68 | | } |
| | | 69 | | |