private BLL.ViewModels.DispatchAllocationViewModel GetAllocationModel(BLL.DispatchAllocation dispatch) { //TODO:Make sure if includeproperties are loaded correctly var fdp = _fdpService.FindById(dispatch.FDPID); BLL.ViewModels.DispatchAllocationViewModel model = new BLL.ViewModels.DispatchAllocationViewModel(fdp); model.Amount = dispatch.Amount; model.Beneficiery = dispatch.Beneficiery; model.BidRefNo = dispatch.BidRefNo; model.CommodityID = dispatch.CommodityID; model.DispatchAllocationID = dispatch.DispatchAllocationID; model.DonorID = dispatch.DonorID; model.FDPID = dispatch.FDPID; model.HubID = dispatch.HubID; model.Month = dispatch.Month; model.PartitionID = dispatch.PartitionID; model.ProgramID = dispatch.ProgramID; model.ProjectCodeID = dispatch.ProjectCodeID; model.RequisitionNo = dispatch.RequisitionNo; model.Round = dispatch.Round; model.ShippingInstructionID = dispatch.ShippingInstructionID; model.TransporterID = dispatch.TransporterID; model.Unit = dispatch.Unit; model.Year = dispatch.Year; model.CommodityTypeID = dispatch.Commodity.CommodityTypeID; return(model); }
/// <summary> /// Gets the allocation model. /// </summary> /// <param name="dispatch">The dispatch.</param> /// <returns></returns> private BLL.DispatchAllocation GetAllocationModel(BLL.ViewModels.DispatchAllocationViewModel dispatch) { BLL.DispatchAllocation model = new BLL.DispatchAllocation(); model.Amount = dispatch.Amount; model.Beneficiery = dispatch.Beneficiery; model.BidRefNo = dispatch.BidRefNo; model.CommodityID = dispatch.CommodityID; if (dispatch.DispatchAllocationID.HasValue) { model.DispatchAllocationID = dispatch.DispatchAllocationID.Value; } model.DonorID = dispatch.DonorID; model.FDPID = dispatch.FDPID; model.HubID = dispatch.HubID; model.Month = dispatch.Month; model.PartitionID = dispatch.PartitionID; model.ProgramID = dispatch.ProgramID; model.ProjectCodeID = dispatch.ProjectCodeID; model.RequisitionNo = dispatch.RequisitionNo; model.Round = dispatch.Round; model.ShippingInstructionID = dispatch.ShippingInstructionID; model.TransporterID = dispatch.TransporterID; model.Unit = dispatch.Unit; model.Year = dispatch.Year; return(model); }
public ActionResult Edit(BLL.ViewModels.DispatchAllocationViewModel allocation) { if (ModelState.IsValid) { BLL.DispatchAllocation alloc = GetAllocationModel(allocation); _dispatchAllocationService.EditDispatchAllocation(alloc); if (this.Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.PathAndQuery)); } else { return(RedirectToAction("Index")); } //return Json(true, JsonRequestBehavior.AllowGet); //return RedirectToAction("Index"); } PrepareEdit(allocation); return(PartialView(allocation)); }
/// <summary> /// Gets the allocation model. /// </summary> /// <param name="dispatch">The dispatch.</param> /// <returns></returns> private BLL.DispatchAllocation GetAllocationModel(BLL.ViewModels.DispatchAllocationViewModel dispatch) { BLL.DispatchAllocation model = new BLL.DispatchAllocation(); model.Amount = dispatch.Amount; model.Beneficiery = dispatch.Beneficiery; model.BidRefNo = dispatch.BidRefNo; model.CommodityID = dispatch.CommodityID; if(dispatch.DispatchAllocationID.HasValue) { model.DispatchAllocationID = dispatch.DispatchAllocationID.Value; } model.DonorID = dispatch.DonorID; model.FDPID = dispatch.FDPID; model.HubID = dispatch.HubID; model.Month = dispatch.Month; model.PartitionID = dispatch.PartitionID; model.ProgramID = dispatch.ProgramID; model.ProjectCodeID = dispatch.ProjectCodeID; model.RequisitionNo = dispatch.RequisitionNo; model.Round = dispatch.Round; model.ShippingInstructionID = dispatch.ShippingInstructionID; model.TransporterID = dispatch.TransporterID; model.Unit = dispatch.Unit; model.Year = dispatch.Year; return model; }