步步为盈
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.

64 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<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.SDCommissionAmount, opt => opt.MapFrom(f => f.SDCommissionAmount))
.ForPath(t => t.OrderDropShipping.PurchaseAmount, opt => opt.MapFrom(f => f.PurchaseAmount))
.ForPath(t => t.OrderDropShipping.PurchaseOrderId, opt => opt.MapFrom(f => f.PurchaseOrderId))
.ForPath(t => t.OrderDropShipping.OrderId, opt => opt.MapFrom(f => f.Id))
.ForPath(t => t.OrderDropShipping.DeliveryFreight, opt => opt.MapFrom(f => f.DeliveryFreight))
.ForPath(t => t.OrderDropShipping.PurchasePlatform, opt => opt.MapFrom(f => f.PurchasePlatform))
.ForPath(t => t.OrderDropShipping.BuyerAccount, opt => opt.MapFrom(f => f.BuyerAccount))
.ForPath(t => t.OrderDropShipping.SellerAccount, opt => opt.MapFrom(f => f.SellerAccount));
}
}
}