private InventoryDTO Map(tblInventory tbl) { var dto = new InventoryDTO { MasterId = tbl.id, DateCreated = tbl.IM_DateCreated, DateLastUpdated = tbl.IM_DateLastUpdated, StatusId = tbl.IM_Status, Balance = tbl.Balance.HasValue ? tbl.Balance.Value : 0, Value = tbl.Value.HasValue ? tbl.Value.Value : 0, ProductMasterID = tbl.ProductId, UnavailableBalance = tbl.UnavailableBalance, WarehouseMasterID = tbl.WareHouseId, }; return dto; }
public Inventory Map(InventoryDTO dto) { if (dto == null) return null; var inventory = Mapper.Map<InventoryDTO, Inventory>(dto); inventory.Warehouse = (Warehouse) _costCentreRepository.GetById(dto.WarehouseMasterID); inventory.Product = _productRepository.GetById(dto.ProductMasterID); return inventory; }