예제 #1
0
 private RegionalRequestDetail BindRegionalRequestDetail(RegionalRequestDetailViewModel regionalRequestDetailViewModel)
 {
     return new RegionalRequestDetail()
                        {
                            Beneficiaries = regionalRequestDetailViewModel.Beneficiaries,
                            Fdpid = regionalRequestDetailViewModel.Fdpid,
                            RegionalRequestID = regionalRequestDetailViewModel.RegionalRequestID,
                            RegionalRequestDetailID = regionalRequestDetailViewModel.RegionalRequestDetailID
                        };
 }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
 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);*/
 }
예제 #5
0
        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));
        }
예제 #6
0
 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);*/
 }