CurrencyBllDtoFactory.cs
893 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 | |
| 7 | namespace SplitApp.WebApp.Application.Mappers; |
| 8 | |
| 9 | public static class CurrencyBllDtoFactory |
| 10 | { |
| 11 | public static CurrencyBllDto Create(Currency entity) => new() |
| 12 | { |
| 13 | Id = entity.Id, |
| 14 | CreatedAt = entity.CreatedAt, |
| 15 | UpdatedAt = entity.UpdatedAt, |
| 16 | Code = entity.Code, |
| 17 | Name = entity.Name, |
| 18 | Symbol = entity.Symbol |
| 19 | }; |
| 20 | |
| 21 | public static List<CurrencyBllDto> CreateList(IEnumerable<Currency> entities) |
| 22 | => entities.Select(Create).ToList(); |
| 23 | |
| 24 | public static Currency ToEntity(CurrencyBllDto dto) => new() |
| 25 | { |
| 26 | Id = dto.Id, |
| 27 | Code = dto.Code, |
| 28 | Name = dto.Name, |
| 29 | Symbol = dto.Symbol |
| 30 | }; |
| 31 | } |
| 32 | |