コード例 #1
0
        public ActionResult DeleteAction(string id)
        {
            RoleRepo roleRepo = new RoleRepo(_context);

            roleRepo.DeleteRole(id);
            return(RedirectToAction(nameof(Index)));
        }
コード例 #2
0
 public IActionResult DeleteRole(string id)
 {
     if (ModelState.IsValid)
     {
         RoleRepo roleRepo = new RoleRepo(_context);
         var      success  = roleRepo.DeleteRole(id);
         if (success)
         {
             return(RedirectToAction(nameof(Index)));
         }
     }
     ViewBag.Error = "An error occurred while deleting this role. Please try again.";
     return(View());
 }
コード例 #3
0
 public IActionResult Delete(RoleVM roleVM)
 {
     _roleRepo.DeleteRole(roleVM.Id);
     return(RedirectToAction(nameof(Index)));
 }