public ActionResult DeleteAction(string id)
        {
            RoleRepo roleRepo = new RoleRepo(_context);

            roleRepo.DeleteRole(id);
            return(RedirectToAction(nameof(Index)));
        }
 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());
 }
Exemple #3
0
 public IActionResult Delete(RoleVM roleVM)
 {
     _roleRepo.DeleteRole(roleVM.Id);
     return(RedirectToAction(nameof(Index)));
 }