| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 3 | | |
| | | 4 | | namespace SVETA.Api.Data.DTO |
| | | 5 | | { |
| | | 6 | | public class PhotoDTO |
| | | 7 | | { |
| | | 8 | | public string PreviewUrl { get; set; } |
| | | 9 | | |
| | | 10 | | public string FullSizeUrl { get; set; } |
| | | 11 | | public int PreviewWidth{get;set;} |
| | | 12 | | public int PreviewHeight{get;set;} |
| | | 13 | | |
| | | 14 | | public int FullSizeWidth{get;set;} |
| | | 15 | | public int FullSizeHeight{get;set;} |
| | | 16 | | public static explicit operator PhotoDTO(Photo photo) => new PhotoDTO |
| | | 17 | | { |
| | | 18 | | PreviewUrl = photo?.PreviewUrl, |
| | | 19 | | FullSizeUrl = photo?.FullSizeUrl, |
| | | 20 | | PreviewWidth = photo?.PreviewWidth ?? 0, |
| | | 21 | | PreviewHeight = photo?.PreviewHeight ?? 0, |
| | | 22 | | FullSizeHeight = photo?.FullSizeHeight ?? 0, |
| | | 23 | | FullSizeWidth = photo?.FullSizeWidth ?? 0 |
| | | 24 | | }; |
| | | 25 | | } |
| | | 26 | | |
| | | 27 | | public class PhotoPrevDto |
| | | 28 | | { |
| | 0 | 29 | | public int PreviewWidth{get;set;} |
| | 0 | 30 | | public int PreviewHeight{get;set;} |
| | 0 | 31 | | public string PreviewUrl { get; set; } |
| | 11 | 32 | | public static explicit operator PhotoPrevDto(Photo photo) => new PhotoPrevDto |
| | 11 | 33 | | { |
| | 11 | 34 | | PreviewUrl = photo?.PreviewUrl, |
| | 11 | 35 | | PreviewWidth = photo?.PreviewWidth ?? 0, |
| | 11 | 36 | | PreviewHeight = photo?.PreviewHeight ?? 0, |
| | 11 | 37 | | }; |
| | | 38 | | } |
| | | 39 | | } |