コード例 #1
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            User i = su.GetById(id);

            su.Delete(i);
            su.Commit();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public JsonResult Delete(int id)
        {
            User user = myService.GetById(id);

            myService.Delete(user);
            myService.Commit();
            return(Json("success", JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        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"));
        }