private CompetitorProductDTO Map(tblCompetitorProducts tbl) { var dto = new CompetitorProductDTO { MasterId = tbl.id, DateCreated = tbl.IM_DateCreated, DateLastUpdated = tbl.IM_DateLastUpdated, StatusId = tbl.IM_Status, ProductName = tbl.Name, ProductDescription = tbl.Description, CompetitorMasterId = tbl.CompetitorId, BrandMasterId = tbl.BrandId, PackagingMasterId = tbl.PackagingId, ProductTypeMasterId = tbl.ProductTypeId, PackagingTypeMasterId = tbl.PackagingTypeId, FlavourMasterId = tbl.FlavourId }; return dto; }
public CompetitorProducts Map(CompetitorProductDTO dto) { if (dto == null) return null; var competitorProduct = Mapper.Map<CompetitorProductDTO, CompetitorProducts>(dto); competitorProduct.Competitor = _competitorRepository.GetById(dto.CompetitorMasterId); competitorProduct.Brand = _productBrandRepository.GetById(dto.BrandMasterId); competitorProduct.Packaging = _productPackagingRepository.GetById(dto.PackagingMasterId); competitorProduct.ProductType = _productTypeRepository.GetById(dto.ProductTypeMasterId); competitorProduct.Flavour = _productFlavourRepository.GetById(dto.FlavourMasterId); competitorProduct.PackagingType = _productPackagingTypeRepository.GetById(dto.PackagingTypeMasterId); return competitorProduct; }