public JsonResult UpdateUserRole(SaveUserRoleViewModel viewModel) { _rolesService.Update(new UpdateUserRoleRequest() { CompanyId = viewModel.CompanyId, Permissions = viewModel.Permisssions.Select(int.Parse).ToArray(), UserId = CurrentUser.UserId, RoleId = Guid.Parse(viewModel.RoleId), RoleName = viewModel.RoleName }); return Json(new SaveUserRoleResultViewModel { Success = true }, JsonRequestBehavior.AllowGet); }
public JsonResult CreateUserRole(SaveUserRoleViewModel viewModel) { var result = _rolesService.Add(new AddUserRoleRequest() { CompanyId = viewModel.CompanyId, RoleName = viewModel.RoleName, Permissions = viewModel.Permisssions.Select(int.Parse).ToArray(), UserId = CurrentUser.UserId }); if (!result.Success) { return Json(new SaveUserRoleResultViewModel { Success = false }); } return Json(new SaveUserRoleResultViewModel { Success = true, RoleId = result.RoleId.ToString() }, JsonRequestBehavior.AllowGet); }