| | | 1 | | using System; |
| | | 2 | | using System.IO; |
| | | 3 | | using SVETA.Api.Helpers; |
| | | 4 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 5 | | |
| | | 6 | | namespace SVETA.Api.Data.DTO.Movements |
| | | 7 | | { |
| | | 8 | | public class MovementAttachmentInfoDto |
| | | 9 | | { |
| | 0 | 10 | | public long Id { get; set; } |
| | 0 | 11 | | public string Name { get; set; } |
| | 0 | 12 | | public long Size { get; set; } |
| | 0 | 13 | | public string Extension { get; set; } |
| | 0 | 14 | | public string ContentType { get; set; } |
| | 0 | 15 | | public DateTime CreatedDateTime { get; set; } |
| | | 16 | | |
| | 0 | 17 | | public MovementAttachmentInfoDto() |
| | 0 | 18 | | { |
| | | 19 | | |
| | 0 | 20 | | } |
| | | 21 | | public static explicit operator MovementAttachmentInfoDto(MovementAttachment attachment) |
| | 0 | 22 | | { |
| | 0 | 23 | | var ext = attachment.FileName.Split(".")[^1]; |
| | 0 | 24 | | return new MovementAttachmentInfoDto |
| | 0 | 25 | | { |
| | 0 | 26 | | Id = attachment.Id, |
| | 0 | 27 | | Name = attachment.FileName, |
| | 0 | 28 | | Size = attachment.Size, |
| | 0 | 29 | | Extension = ext, |
| | 0 | 30 | | ContentType = ContentTypeChecker.CheckContentType(ext), |
| | 0 | 31 | | CreatedDateTime = attachment.CreationDateTime |
| | 0 | 32 | | }; |
| | 0 | 33 | | } |
| | | 34 | | } |
| | | 35 | | |
| | | 36 | | public class MovementAttachmentReadResult |
| | | 37 | | { |
| | | 38 | | public Stream Stream { get; set; } |
| | | 39 | | public string ContentType { get; set; } |
| | | 40 | | public string FileName { get; set; } |
| | | 41 | | } |
| | | 42 | | } |