| | | 1 | | using System; |
| | | 2 | | using System.ComponentModel.DataAnnotations; |
| | | 3 | | using System.Collections.Generic; |
| | | 4 | | using System.Linq; |
| | | 5 | | using System.Threading.Tasks; |
| | | 6 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 7 | | using SVETA.Api.Helpers; |
| | | 8 | | using WinSolutions.Sveta.Common.Extensions; |
| | | 9 | | |
| | | 10 | | namespace SVETA.Api.Data.DTO |
| | | 11 | | { |
| | | 12 | | public class BrandInputDTO |
| | | 13 | | { |
| | | 14 | | [NotNullOrWhiteSpaceValidator] |
| | | 15 | | public string Name { get; set; } |
| | | 16 | | |
| | | 17 | | public long ParentId { get; set; } |
| | | 18 | | } |
| | | 19 | | |
| | | 20 | | public class BrandOutputDTO |
| | | 21 | | { |
| | 0 | 22 | | public BrandOutputDTO(Brand brand) |
| | 0 | 23 | | { |
| | 0 | 24 | | Id = brand.Id; |
| | 0 | 25 | | Name = brand.Name.Elipsist(200); |
| | 0 | 26 | | if(brand.Parent != null) |
| | 0 | 27 | | { |
| | 0 | 28 | | Parent = new BrandShortOutputDTO(brand.Parent); |
| | 0 | 29 | | } |
| | 0 | 30 | | } |
| | | 31 | | |
| | 0 | 32 | | public long Id { get; set; } |
| | | 33 | | |
| | 0 | 34 | | public string Name { get; set; } |
| | | 35 | | |
| | 0 | 36 | | public BrandShortOutputDTO Parent { get; set; } |
| | 0 | 37 | | public bool Expandable { get; set; } |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | public class BrandShortOutputDTO |
| | | 41 | | { |
| | | 42 | | public BrandShortOutputDTO(Brand brand) |
| | | 43 | | { |
| | | 44 | | Id = brand.Id; |
| | | 45 | | Name = brand.Name.Elipsist(200); |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | public long Id { get; set; } |
| | | 49 | | |
| | | 50 | | public string Name { get; set; } |
| | | 51 | | } |
| | | 52 | | } |