public async Task SetChildName() { if (_deliveryChainVm.SupplierEntry == "True") // supplier alrerady exists { _deliveryChain.ChildID = _deliveryChainVm.ChildID; _deliveryChain.ChildType = "S"; //adding a supplier as a child // _deliveryChain.ChildName = suppliers.FirstOrDefault().SupplierName; } else if (_deliveryChainVm.PartnerEntry == "True") // partner alrerady exists { _deliveryChain.ChildID = _deliveryChainVm.ChildID; _deliveryChain.ChildType = "P"; //adding a partner as a child // _deliveryChain.ChildName = _deliveryChainVm.NewChildName; } else // adding a new row to the partner table { // Commit on creation of the new row in the table and then // retrieve the information based on the NewChildName Entered if needed _deliveryChain.ChildType = "P"; //adding a partner //_deliveryChain.ChildName = _deliveryChainVm.NewChildName; _deliveryChain.ChildID = _ampRepository.NextPartnerID(); //Partner Builder and insertion of the new row into the pratner master table PartnerBuilder partnerBuilder = new PartnerBuilder(_deliveryChainVm, _ampRepository, _AriesService, _user); PartnerMaster partnerMaster = await partnerBuilder.Build(); _ampRepository.InsertPartner(partnerMaster); _ampRepository.Save(); } }
public async Task <PartnerMaster> Build() { _partnerMaster = new PartnerMaster { PartnerID = _ampRepository.NextPartnerID(), PartnerName = _deliveryChainVm.NewChildName, Status = "A", LastUpdated = DateTime.Now, UserID = _user }; return(_partnerMaster); }