using AutoMapper; using BBWY.Server.Model.Db; using BBWY.Server.Model.Dto; using System.Collections.Generic; using System.Linq; namespace BBWY.Server.Model { public class MappingProfiles : Profile { // private IDictionary storeDictionary; public MappingProfiles() { CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap().ForMember(t => t.Id, opt => opt.MapFrom(f => f.SkuId)); CreateMap().ForMember(t => t.OrderStartTime, opt => opt.MapFrom(f => f.StartTime)) .ForMember(t => t.OrderEndTime, opt => opt.MapFrom(f => f.EndTime)) .ForMember(t => t.OrderModifyTime, opt => opt.MapFrom(f => f.ModifyTime)) .ForPath(t => t.Consignee.IsDecode, opt => opt.MapFrom(f => f.IsDecode)) .ForPath(t => t.Consignee.Province, opt => opt.MapFrom(f => f.Province)) .ForPath(t => t.Consignee.City, opt => opt.MapFrom(f => f.City)) .ForPath(t => t.Consignee.County, opt => opt.MapFrom(f => f.County)) .ForPath(t => t.Consignee.Town, opt => opt.MapFrom(f => f.Town)) .ForPath(t => t.Consignee.Address, opt => opt.MapFrom(f => f.Address)) .ForPath(t => t.Consignee.Mobile, opt => opt.MapFrom(f => f.Mobile)) .ForPath(t => t.Consignee.TelePhone, opt => opt.MapFrom(f => f.TelePhone)) .ForPath(t => t.Consignee.ContactName, opt => opt.MapFrom(f => f.ContactName)) .ForPath(t => t.OrderCost.OrderId, opt => opt.MapFrom(f => f.Id)) .ForPath(t => t.OrderCost.PurchaseAmount, opt => opt.MapFrom(f => f.PurchaseAmount ?? 0)) .ForPath(t => t.OrderCost.Profit, opt => opt.MapFrom(f => f.Profit ?? 0)) .ForPath(t => t.OrderCost.DeliveryExpressFreight, opt => opt.MapFrom(f => f.DeliveryExpressFreight ?? 0)) .ForPath(t => t.OrderCost.PlatformCommissionAmount, opt => opt.MapFrom(f => f.PlatformCommissionAmount ?? 0)) .ForPath(t => t.OrderCost.PlatformCommissionRatio, opt => opt.MapFrom(f => f.PlatformCommissionRatio ?? 0)) .ForPath(t => t.OrderCost.PreferentialAmount, opt => opt.MapFrom(f => f.PreferentialAmount)) .ForPath(t => t.OrderCost.IsManualEdited, opt => opt.MapFrom(f => f.IsManualEdited)) .ForPath(t => t.OrderCost.SDCommissionAmount, opt => opt.MapFrom(f => f.SDCommissionAmount)) .ForPath(t => t.OrderCost.SDOrderAmount, opt => opt.MapFrom(f => f.SDOrderAmount)) .ForPath(t => t.OrderCost.RefundAmount, opt => opt.MapFrom(f => f.RefundAmount)) .ForPath(t => t.OrderCost.RefundPurchaseAmount, opt => opt.MapFrom(f => f.RefundPurchaseAmount)) .ForPath(t => t.OrderCost.AfterTotalCost, opt => opt.MapFrom(f => f.AfterTotalCost)); CreateMap(); } } }