forked from sanchezvem/PyroFetes
69 lines
2.7 KiB
C#
69 lines
2.7 KiB
C#
using AutoMapper;
|
|
using PyroFetes.DTO.Deliverer.Response;
|
|
using PyroFetes.DTO.DeliveryNote.Response;
|
|
using PyroFetes.DTO.Price.Response;
|
|
using PyroFetes.DTO.Product.Response;
|
|
using PyroFetes.DTO.ProductDelivery.Response;
|
|
using PyroFetes.DTO.PurchaseOrder.Response;
|
|
using PyroFetes.DTO.PurchaseProduct.Response;
|
|
using PyroFetes.DTO.Quotation.Response;
|
|
using PyroFetes.DTO.QuotationProduct.Response;
|
|
using PyroFetes.DTO.SettingDTO.Response;
|
|
using PyroFetes.DTO.Supplier.Response;
|
|
using PyroFetes.DTO.User.Response;
|
|
using PyroFetes.DTO.WareHouseProduct.Response;
|
|
using PyroFetes.Models;
|
|
|
|
namespace PyroFetes.MappingProfiles;
|
|
|
|
public class EntityToDtoMappings : Profile
|
|
{
|
|
public EntityToDtoMappings()
|
|
{
|
|
CreateMap<Deliverer, GetDelivererDto>();
|
|
|
|
CreateMap<Supplier, GetSupplierDto>();
|
|
|
|
CreateMap<DeliveryNote, GetDeliveryNoteDto>();
|
|
|
|
CreateMap<Price, GetPriceDto>();
|
|
|
|
CreateMap<Product, GetProductDto>();
|
|
|
|
CreateMap<ProductDelivery, GetProductDeliveryDto>();
|
|
|
|
// CreateMap<PurchaseOrder, GetPurchaseOrderDto>();
|
|
//
|
|
// CreateMap<PurchaseProduct, GetPurchaseProductDto>();
|
|
|
|
CreateMap<PurchaseOrder, GetPurchaseOrderDto>()
|
|
.ForMember(dest => dest.Products,
|
|
opt => opt.MapFrom(src => src.PurchaseProducts));
|
|
|
|
CreateMap<PurchaseProduct, GetPurchaseProductDto>()
|
|
.ForMember(dest => dest.ProductId, opt => opt.MapFrom(src => src.ProductId))
|
|
.ForMember(dest => dest.Quantity, opt => opt.MapFrom(src => src.Quantity))
|
|
.ForMember(dest => dest.ProductName, opt => opt.MapFrom(src => src.Product.Name))
|
|
.ForMember(dest => dest.ProductReferences, opt => opt.MapFrom(src => src.Product.Reference));
|
|
|
|
// CreateMap<Quotation, GetQuotationDto>();
|
|
//
|
|
// CreateMap<QuotationProduct, GetQuotationProductDto>();
|
|
|
|
CreateMap<Quotation, GetQuotationDto>()
|
|
.ForMember(dest => dest.Products,
|
|
opt => opt.MapFrom(src => src.QuotationProducts));
|
|
|
|
CreateMap<QuotationProduct, GetQuotationProductDto>()
|
|
.ForMember(dest => dest.ProductId, opt => opt.MapFrom(src => src.ProductId))
|
|
.ForMember(dest => dest.Quantity, opt => opt.MapFrom(src => src.Quantity))
|
|
.ForMember(dest => dest.ProductName, opt => opt.MapFrom(src => src.Product.Name))
|
|
.ForMember(dest => dest.ProductReferences, opt => opt.MapFrom(src => src.Product.Reference));
|
|
|
|
CreateMap<Setting, GetSettingDto>();
|
|
|
|
CreateMap<User, GetUserDto>();
|
|
|
|
CreateMap<WarehouseProduct, GetWareHouseProductDto>();
|
|
}
|
|
} |