public async Task <GarmentLeftoverWarehouseExpenditureAvalItem> GetNewDataItemFabric() { var receiptAval = await Task.Run(() => ReceiptAvalDataUtil.GetTestData()); var DataFabric = new GarmentLeftoverWarehouseExpenditureAvalItem { StockId = 1, UnitId = 1, UnitCode = "Unit", UnitName = "Unit", AvalReceiptNo = receiptAval.AvalReceiptNo, AvalReceiptId = receiptAval.Id, Quantity = receiptAval.TotalAval, }; return(DataFabric); }
public GarmentLeftoverWarehouseExpenditureAval CopyData(GarmentLeftoverWarehouseExpenditureAval oldData) { GarmentLeftoverWarehouseExpenditureAval newData = new GarmentLeftoverWarehouseExpenditureAval(); PropertyCopier <GarmentLeftoverWarehouseExpenditureAval, GarmentLeftoverWarehouseExpenditureAval> .Copy(oldData, newData); newData.Items = new List <GarmentLeftoverWarehouseExpenditureAvalItem>(); foreach (var oldItem in oldData.Items) { GarmentLeftoverWarehouseExpenditureAvalItem newItem = new GarmentLeftoverWarehouseExpenditureAvalItem(); PropertyCopier <GarmentLeftoverWarehouseExpenditureAvalItem, GarmentLeftoverWarehouseExpenditureAvalItem> .Copy(oldItem, newItem); newData.Items.Add(newItem); } return(newData); }
public GarmentLeftoverWarehouseExpenditureAval MapToModel(GarmentLeftoverWarehouseExpenditureAvalViewModel viewModel) { GarmentLeftoverWarehouseExpenditureAval model = new GarmentLeftoverWarehouseExpenditureAval(); PropertyCopier <GarmentLeftoverWarehouseExpenditureAvalViewModel, GarmentLeftoverWarehouseExpenditureAval> .Copy(viewModel, model); if (viewModel.Buyer != null) { model.BuyerId = viewModel.Buyer.Id; model.BuyerCode = viewModel.Buyer.Code; model.BuyerName = viewModel.Buyer.Name; } model.Items = new List <GarmentLeftoverWarehouseExpenditureAvalItem>(); foreach (var viewModelItem in viewModel.Items) { GarmentLeftoverWarehouseExpenditureAvalItem modelItem = new GarmentLeftoverWarehouseExpenditureAvalItem(); PropertyCopier <GarmentLeftoverWarehouseExpenditureAvalItemViewModel, GarmentLeftoverWarehouseExpenditureAvalItem> .Copy(viewModelItem, modelItem); if (viewModelItem.Unit != null) { modelItem.UnitId = long.Parse(viewModelItem.Unit.Id); modelItem.UnitCode = viewModelItem.Unit.Code; modelItem.UnitName = viewModelItem.Unit.Name; } if (viewModelItem.Product != null) { modelItem.ProductId = long.Parse(viewModelItem.Product.Id); modelItem.ProductName = viewModelItem.Product.Name; modelItem.ProductCode = viewModelItem.Product.Code; } if (viewModelItem.Uom != null) { modelItem.UomId = long.Parse(viewModelItem.Uom.Id); modelItem.UomUnit = viewModelItem.Uom.Unit; } model.Items.Add(modelItem); } return(model); }