CurrencyBllDtoFactory.cs
936 bytes
| 1 | using SplitApp.WebApp.Application.DTO; |
|---|---|
| 2 | using SplitApp.Modules.Trips.Domain.Entities; |
| 3 | using SplitApp.Modules.Trips.Domain.Enums; |
| 4 | using SplitApp.Modules.Expenses.Domain.Entities; |
| 5 | using SplitApp.Modules.Expenses.Domain.Enums; |
| 6 | using SplitApp.Modules.Users.Domain.Entities; |
| 7 | |
| 8 | namespace SplitApp.WebApp.Application.Mappers; |
| 9 | |
| 10 | public static class CurrencyBllDtoFactory |
| 11 | { |
| 12 | public static CurrencyBllDto Create(Currency entity) => new() |
| 13 | { |
| 14 | Id = entity.Id, |
| 15 | CreatedAt = entity.CreatedAt, |
| 16 | UpdatedAt = entity.UpdatedAt, |
| 17 | Code = entity.Code, |
| 18 | Name = entity.Name, |
| 19 | Symbol = entity.Symbol |
| 20 | }; |
| 21 | |
| 22 | public static List<CurrencyBllDto> CreateList(IEnumerable<Currency> entities) |
| 23 | => entities.Select(Create).ToList(); |
| 24 | |
| 25 | public static Currency ToEntity(CurrencyBllDto dto) => new() |
| 26 | { |
| 27 | Id = dto.Id, |
| 28 | Code = dto.Code, |
| 29 | Name = dto.Name, |
| 30 | Symbol = dto.Symbol |
| 31 | }; |
| 32 | } |
| 33 | |