private RegionalRequestDetail BindRegionalRequestDetail(RegionalRequestDetailViewModel regionalRequestDetailViewModel) { return new RegionalRequestDetail() { Beneficiaries = regionalRequestDetailViewModel.Beneficiaries, Fdpid = regionalRequestDetailViewModel.Fdpid, RegionalRequestID = regionalRequestDetailViewModel.RegionalRequestID, RegionalRequestDetailID = regionalRequestDetailViewModel.RegionalRequestDetailID }; }
public ActionResult Allocation_Update2(RegionalRequestDetailViewModel regionalRequestDetail) { // if (regionalRequestDetail != null && ModelState.IsValid) { var target = _regionalRequestDetailService.FindById(regionalRequestDetail.RegionalRequestDetailID); if (target != null) { target.Beneficiaries = regionalRequestDetail.Beneficiaries; target.Fdpid = regionalRequestDetail.Fdpid; _regionalRequestDetailService.EditRegionalRequestDetail(target); } } var requestDetails = _regionalRequestDetailService.FindBy(t => t.RegionalRequestID == regionalRequestDetail.RegionalRequestID); var requestDetailViewModels = (from dtl in requestDetails select BindRegionalRequestDetailViewModel(dtl)); return Json(requestDetailViewModels, JsonRequestBehavior.AllowGet); //return Json(new[] { regionalRequestDetail }.ToDataSourceResult(request, ModelState)); }
public ActionResult Allocation_Update([DataSourceRequest] DataSourceRequest request, RegionalRequestDetailViewModel regionalRequestDetail) { if (regionalRequestDetail != null && ModelState.IsValid) { var target = _regionalRequestDetailService.FindById(regionalRequestDetail.RegionalRequestDetailID); if (target != null) { target.Beneficiaries = regionalRequestDetail.Beneficiaries; _regionalRequestDetailService.EditRegionalRequestDetail(target); } } return Json(new[] { regionalRequestDetail }.ToDataSourceResult(request, ModelState)); }
public ActionResult Allocation_Create2(RegionalRequestDetailViewModel regionalRequestDetailViewModel) { if (regionalRequestDetailViewModel != null && ModelState.IsValid) { _regionalRequestDetailService.AddRegionalRequestDetail(BindRegionalRequestDetail(regionalRequestDetailViewModel)); } return RedirectToAction("Allocation_Read", new {request=new DataSourceRequest(), id = regionalRequestDetailViewModel.RegionalRequestID }); /* var requestDetails = _regionalRequestDetailService.FindBy(t => t.RegionalRequestID == regionalRequestDetailViewModel.RegionalRequestID); var requestDetailViewModels = (from dtl in requestDetails select BindRegionalRequestDetailViewModel(dtl)); return Json(requestDetailViewModels, JsonRequestBehavior.AllowGet);*/ }
public ActionResult Allocation_Create([DataSourceRequest] DataSourceRequest request, RegionalRequestDetailViewModel regionalRequestDetailViewModel) { if (regionalRequestDetailViewModel != null && ModelState.IsValid) { _regionalRequestDetailService.AddRegionalRequestDetail(BindRegionalRequestDetail(regionalRequestDetailViewModel)); } return Json(new[] { regionalRequestDetailViewModel }.ToDataSourceResult(request, ModelState)); }
public ActionResult Allocation_Create2(RegionalRequestDetailViewModel regionalRequestDetailViewModel) { if (regionalRequestDetailViewModel != null && ModelState.IsValid) { RegionalRequestDetail model = BindRegionalRequestDetail(regionalRequestDetailViewModel); _regionalRequestDetailService.AddCommodityFdp(model); regionalRequestDetailViewModel.RegionalRequestDetailID = model.RegionalRequestDetailID; return Json(new { success = 1, record = regionalRequestDetailViewModel }, JsonRequestBehavior.AllowGet); } return Json(new { success = 0, record = regionalRequestDetailViewModel, message = "Invalid input" }, JsonRequestBehavior.AllowGet); // return RedirectToAction("Allocation_Read", new {request=new DataSourceRequest(), id = regionalRequestDetailViewModel.RegionalRequestID }); /* var requestDetails = _regionalRequestDetailService.FindBy(t => t.RegionalRequestID == regionalRequestDetailViewModel.RegionalRequestID); var requestDetailViewModels = (from dtl in requestDetails select BindRegionalRequestDetailViewModel(dtl)); return Json(requestDetailViewModels, JsonRequestBehavior.AllowGet);*/ }