Exemple #1
0
 public IHttpActionResult DeleteUserRole(int id)
 {
     try
     {
         string accessToken = Request.Headers.Authorization == null ? null : Request.Headers.Authorization.Parameter;
         string msg         = _service.DeleteUserRole(id, accessToken);
         return(Content(HttpStatusCode.OK, msg));
     }
     catch (Exception ex)
     {
         Logger.WriteException("DeleteUserRole : ", ex);
         return(Content(HttpStatusCode.BadRequest, ex.GetBaseException().Message));
     }
 }
Exemple #2
0
        public ActionResult Save(UserFormViewModel user)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("New", "User"));
            }
            _userAppService.DeleteUserApps(user.BlazerId);
            _userRoleService.DeleteUserRole(user.BlazerId);

            var roleIds = user.AppRoles.Select(x => x.Id).ToList();
            var appIds  = user.Apps.Select(x => x.Id).ToList();

            _userAppService.AddUserApps(user.BlazerId, appIds, roleIds);
            _userRoleService.AddUserRole(user.BlazerId, user.RoleId);

            return(RedirectToAction("Index", "User"));
        }
Exemple #3
0
 public static void DeleteUserRole(UserRole userRole)
 {
     UserRoleService.DeleteUserRole(userRole);
 }