fix
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
namespace MyOffice.Web.Models.Currency;
|
||||
|
||||
using AutoMapper;
|
||||
using MyOffice.Services.Currency.Domain;
|
||||
|
||||
public class CurrencyViewModel: BaseViewModel
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
@@ -11,4 +14,23 @@ public class CurrencyViewModel: BaseViewModel
|
||||
public int? Quantity { get; set; }
|
||||
public DateTime? RateDate { get; set; }
|
||||
public bool IsPrimary { get; set; }
|
||||
}
|
||||
|
||||
public class CurrencyViewModelProfile: Profile
|
||||
{
|
||||
public CurrencyViewModelProfile()
|
||||
{
|
||||
CreateMap<CurrencyDto, CurrencyViewModel>();
|
||||
|
||||
CreateMap<CurrencyWithRateDto, CurrencyViewModel>()
|
||||
.ForMember(x => x.Id, o => o.MapFrom(x => x.Currency.Id))
|
||||
.ForMember(x => x.Code, o => o.MapFrom(x => x.Currency.CurrencyGlobalId))
|
||||
.ForMember(x => x.Name, o => o.MapFrom(x => x.Currency.Name))
|
||||
.ForMember(x => x.ShortName, o => o.MapFrom(x => x.Currency.ShortName))
|
||||
.ForMember(x => x.Rate, o => o.MapFrom(x => x.Rate == null ? (decimal?)null : x.Rate.Rate))
|
||||
.ForMember(x => x.IsPrimary, o => o.MapFrom(x => x.Currency.IsPrimary))
|
||||
.ForMember(x => x.Quantity, o => o.MapFrom(x => x.Rate == null ? (int?)null : x.Rate.Quantity))
|
||||
.ForMember(x => x.RateDate, o => o.MapFrom(x => x.Rate == null ? (DateTime?)null : x.Rate.DateTime))
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user