public ActionResult AddRole(ManageUserRoleBindingModel model) { if (ModelState.IsValid) { bool isAdded = this.service.AddToRole(UserManager, model.UserId, model.RoleName); if (isAdded) { this.AddNotification($"Role {model.RoleName} has been added to this user", NotificationType.SUCCESS); return(RedirectToAction("EditRole", "Admin", new { Area = "Admin", model.UserId })); } } this.AddNotification($"Role {model.RoleName} has NOT been added to this user", NotificationType.ERROR); return(RedirectToAction("EditRole", "Admin", new { Area = "Admin", model.UserId })); }
public ActionResult RemoveRole(ManageUserRoleBindingModel model) { if (ModelState.IsValid) { bool isRemoved = this.service.RemoveFromRole(UserManager, model.UserId, model.RoleName); if (isRemoved) { this.AddNotification($"{model.RoleName} role has been removed from this user", NotificationType.SUCCESS); return(RedirectToAction("EditRole", "Admin", new { Area = "Admin", model.UserId })); } } this.AddNotification($"{model.RoleName} role has NOT been removed from this user", NotificationType.ERROR); return(RedirectToAction("EditRole", "Admin", new { Area = "Admin", model.UserId })); }