public ActionResult Create(TransferViewModel transferViewModel) { if (ModelState.IsValid && transferViewModel != null) { var transfer = GetTransfer(transferViewModel); _transferService.AddTransfer(transfer); return RedirectToAction("Index"); } return View(transferViewModel); }
public ActionResult Create() { var transfer = new TransferViewModel(); transfer.CommoditySource = _commonService.GetCommditySourceName(5);//commodity source for transfer ViewBag.ProgramID = new SelectList(_commonService.GetPrograms(), "ProgramID", "Name"); ViewBag.SourceHubID = new SelectList(_commonService.GetAllHubs(), "HubID", "Name"); ViewBag.CommodityID = new SelectList(_commonService.GetCommodities(), "CommodityID", "Name"); ViewBag.CommodityTypeID = new SelectList(_commonService.GetCommodityTypes(), "CommodityTypeID", "Name"); ViewBag.DestinationHubID = new SelectList(_commonService.GetAllHubs(), "HubID", "Name"); return View(transfer); }
private Transfer GetTransfer(TransferViewModel transferViewModel) { var transfer = new Transfer() { ShippingInstructionID=_commonService.GetShippingInstruction(transferViewModel.SiNumber), SourceHubID=transferViewModel.SourceHubID, ProgramID=transferViewModel.ProgramID, CommoditySourceID=5, CommodityID =transferViewModel.CommodityID, DestinationHubID =transferViewModel.DestinationHubID, ProjectCode=transferViewModel.ProjectCode, Quantity=transferViewModel.Quantity, CreatedDate=DateTime.Today, ReferenceNumber=transferViewModel.ReferenceNumber, StatusID=(int)LocalPurchaseStatus.Draft }; return transfer; }