步步为盈
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
4.9 KiB

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<string, string> storeDictionary;
public MappingProfiles()
{
CreateMap<InputPurchaseSchemeRequest, PurchaseScheme>();
CreateMap<EditPurchaseSchemeRequest, PurchaseScheme>();
CreateMap<InputPurchaseSchemeProductRequest, PurchaseSchemeProduct>();
CreateMap<InputPurchaseSchemeProductSkuRequest, PurchaseSchemeProductSku>();
CreateMap<PurchaseScheme, PurchaseSchemeResponse>();
CreateMap<PurchaseSchemeProduct, PurchaseSchemeProductResponse>();
CreateMap<PurchaseSchemeProductSku, PurchaseSchemeProductSkuResponse>();
CreateMap<AddPurchaseOrderRequest, PurchaseOrder>();
CreateMap<PurchaseOrder, PurchaseOrderResponse>();
CreateMap<OrderDropShippingRequest, OrderDropShipping>();
CreateMap<OrderDropShipping, OrderDropShippingResponse>();
CreateMap<OrderCostDetailRequest, OrderCostDetail>();
CreateMap<OrderCostDetail, OrderCostDetailResponse>();
CreateMap<OrderConsignee, ConsigneeResponse>();
CreateMap<OrderCost, OrderCostResponse>();
CreateMap<OrderCoupon, OrderCouponResponse>();
CreateMap<OrderSku, OrderSkuResponse>().ForMember(t => t.Id, opt => opt.MapFrom(f => f.SkuId));
CreateMap<Order, OrderResponse>().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.IsEstimateCost, opt => opt.MapFrom(f => f.IsEstimateCost))
.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<AddOrEditPromotionTaskRequest, PromotionTask>();
CreateMap<ProductSkuResponse, ProductSkuWithSchemeResponse>();
}
}
}