public ActionResult Delete(string email, string roleName) { UserRoleRepo userRoleRepo = new UserRoleRepo(_serviceProvider); userRoleRepo.RemoveUserRole(email, roleName); return(RedirectToAction("Detail", "UserRole", new { userName = email })); }
public void MakeUserManager([FromBody] EmployeeIdVM employee) { //This method simply strips the Employee role from the user and then adds on the Manager role UserRoleRepo repo = new UserRoleRepo(service); repo.RemoveUserRole(employee.Email, "Employee").Wait(); repo.AddUserRole(employee.Email, "Manager").Wait(); }
public async Task <IActionResult> DeleteUserRole(string email, string roleName) { if (ModelState.IsValid) { UserRoleRepo userRoleRepo = new UserRoleRepo(_serviceProvider); var success = await userRoleRepo.RemoveUserRole(email, roleName); if (success) { return(RedirectToAction(nameof(Index))); } } ViewBag.Error = "An error occurred while deleting this role. Please try again."; return(View()); }
public async Task <ActionResult> Remove(UserRoleVM userRoleVM) { UserRoleRepo userRoleRepo = new UserRoleRepo(_serviceProvider); if (ModelState.IsValid) { var addUR = await userRoleRepo.RemoveUserRole(userRoleVM.Email, userRoleVM.Role); } try { return(RedirectToAction("Detail", "UserRole", new { userName = userRoleVM.Email })); } catch { return(View()); } }