public ActionResult Edit(UsersExt model) { if (ModelState.IsValid) { try { UsersRepository uRepo = new UsersRepository(); if (uRepo.Update(model, ModelState, this)) { return RedirectToAction("Index", "Users"); } } catch (Exception ex) { ModelState.AddModelError("", "Error: Please Correct/Enter All the Information below to Save this Record, All Fields are Mandatory"); ErrorHandling.HandleModelStateException(ex, ModelState); } } return View(model); }
public ActionResult _Destroy([DataSourceRequest]DataSourceRequest request, UsersExt userExt) { using (DBEntities db = new DBEntities()) { try { UsersRepository uRepo = new UsersRepository(); uRepo.Delete(userExt, this); } catch (Exception ex) { ErrorHandling.HandleModelStateException(ex, ModelState); ErrorHandling.SetErrorCode(ex); throw new Exception(""); } } return Json(request); }