Exemplo n.º 1
0
 public ActionResult FDP_Update([DataSourceRequest] DataSourceRequest request, FDPViewModel fdpViewModel)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var fdp = FDPViewModelBinder.BindFDP(fdpViewModel);
             _fdpService.EditFDP(fdp);
             ModelState.AddModelError("Success", @"Success: FDP Updated.");
             return(RedirectToAction("Index"));
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("Errors", @"Error: FDP not registered. All fields need to be filled.");
         }
     }
     return(Json(new[] { fdpViewModel }.ToDataSourceResult(request, ModelState)));
 }
Exemplo n.º 2
0
        public virtual ActionResult Edit(FDP fdp)
        {
            if (ModelState.IsValid)
            {
                _FDPService.EditFDP(fdp);


                //return RedirectToAction("Index");
                return(Json(new { success = true }));
            }

            ViewBag.FDPID = new SelectList(_FDPService.GetAllFDP(), "FDPID", "Name", fdp.FDPID);
            return(PartialView(fdp));
        }