| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using System.Linq; |
| | | 4 | | using System.Threading.Tasks; |
| | | 5 | | using System.ComponentModel.DataAnnotations; |
| | | 6 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 7 | | |
| | | 8 | | namespace SVETA.Api.Data.DTO |
| | | 9 | | { |
| | | 10 | | public class CategoryResponseDTO |
| | | 11 | | { |
| | 0 | 12 | | public CategoryResponseDTO() |
| | 0 | 13 | | { |
| | | 14 | | |
| | 0 | 15 | | } |
| | | 16 | | |
| | 0 | 17 | | public CategoryResponseDTO(Category x) |
| | 0 | 18 | | { |
| | 0 | 19 | | ParentId = x.Parent == null ? 0 : x.Parent.Id; |
| | 0 | 20 | | ParentCode = x.Parent?.Code; |
| | 0 | 21 | | Code = x.Code; |
| | 0 | 22 | | Name = x.Name; |
| | 0 | 23 | | Id = x.Id; |
| | 0 | 24 | | GoogleProductCategoryCode = x.GoogleProductCategoryCode; |
| | 0 | 25 | | ExcludeFromGoogleFeed = x.ExcludeFromGoogleFeed; |
| | 0 | 26 | | ExcludeFromYandexFeed = x.ExcludeFromYandexFeed; |
| | 0 | 27 | | } |
| | | 28 | | |
| | 0 | 29 | | public long Id { get; set; } |
| | | 30 | | |
| | 0 | 31 | | public long ParentId { get; set; } |
| | | 32 | | |
| | 0 | 33 | | public string ParentCode { get; set; } |
| | | 34 | | |
| | 0 | 35 | | public string Name { get; set; } |
| | | 36 | | |
| | 0 | 37 | | public string Code { get; set; } |
| | | 38 | | |
| | 0 | 39 | | public bool Expandable { get; set; } |
| | | 40 | | |
| | 0 | 41 | | public string GoogleProductCategoryCode { get; set; } |
| | | 42 | | |
| | 0 | 43 | | public bool ExcludeFromYandexFeed { get; set; } |
| | | 44 | | |
| | 0 | 45 | | public bool ExcludeFromGoogleFeed { get; set; } |
| | | 46 | | |
| | 0 | 47 | | public List<CategoryResponseDTO> Children { get; set; } = new List<CategoryResponseDTO>(); |
| | | 48 | | } |
| | | 49 | | |
| | | 50 | | public class CategoryRequestDTO |
| | | 51 | | { |
| | | 52 | | public long ParentId { get; set; } |
| | | 53 | | |
| | | 54 | | [NotNullOrWhiteSpaceValidator] |
| | | 55 | | public string Name { get; set; } |
| | | 56 | | |
| | | 57 | | [NotNullOrWhiteSpaceValidator] |
| | | 58 | | public string Code { get; set; } |
| | | 59 | | |
| | | 60 | | public string GoogleProductCategoryCode { get; set; } |
| | | 61 | | public bool ExcludeFromYandexFeed { get; set; } |
| | | 62 | | public bool ExcludeFromGoogleFeed { get; set; } |
| | | 63 | | } |
| | | 64 | | |
| | | 65 | | public class CategoryForFeedDTO |
| | | 66 | | { |
| | | 67 | | public CategoryForFeedDTO() { } |
| | | 68 | | |
| | | 69 | | public CategoryForFeedDTO(Category x) |
| | | 70 | | { |
| | | 71 | | Id = x.Id; |
| | | 72 | | Name = x.Name; |
| | | 73 | | GoogleProductCategoryCode = x.GoogleProductCategoryCode; |
| | | 74 | | ExcludeFromGoogleFeed = x.ExcludeFromGoogleFeed; |
| | | 75 | | ExcludeFromYandexFeed = x.ExcludeFromYandexFeed; |
| | | 76 | | } |
| | | 77 | | |
| | | 78 | | public long Id { get; set; } |
| | | 79 | | public string Name { get; set; } |
| | | 80 | | public bool ExcludeFromYandexFeed { get; set; } |
| | | 81 | | public bool ExcludeFromGoogleFeed { get; set; } |
| | | 82 | | public string GoogleProductCategoryCode { get; set; } |
| | | 83 | | } |
| | | 84 | | } |