public ActionResult Delete(int id, FormCollection collection) { User i = su.GetById(id); su.Delete(i); su.Commit(); return(RedirectToAction("Index")); }
public JsonResult Delete(int id) { User user = myService.GetById(id); myService.Delete(user); myService.Commit(); return(Json("success", JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteAction(int Id) { try { if (ModelState.IsValid) { ServiceUser.Delete(Id); } else { ModelState.AddModelError("Error", "Algunos datos ingresados no son válidos"); return(View("Delete")); } } catch (Exception ex) { ModelState.AddModelError("Error", "Se ha producido un error: " + ex.Message); return(View("Delete")); } return(RedirectToAction("Index")); }