public ActionResult Edit(UserGroupVM userGroupVM) { if (!ModelState.IsValid) { return(Json(new OperationResult(OperationResultType.ParamError, "参数错误,请重新检查输入"))); } var result = _userGroupService.Update(userGroupVM); result.Message = result.Message ?? result.ResultType.GetDescription(); return(Json(result)); }
public ActionResult Update(UserGroup userGroup, UserGroupUpdateCommand userGroupUpdateCommand, User currentUser) { Require.NotNull(userGroup, nameof(userGroup)); Require.NotNull(currentUser, nameof(currentUser)); if (!ModelState.IsValid) { UserGroupUpdateViewModel brokerPoolUpdateViewModel = GetFinancialBrokerPoolUpdateViewModel(userGroupUpdateCommand); return(View(brokerPoolUpdateViewModel)); } UserGroupService.Update(userGroup, userGroupUpdateCommand.UserGroupDto, currentUser); return(RedirectToAction("Index")); }
public ActionResult Update(UserGroup userGroup, UserGroupUpdateCommand userGroupUpdateCommand, User currentUser) { Require.NotNull(userGroup, "userGroup"); Require.NotNull(userGroupUpdateCommand, "userGroupUpdateCommand"); Require.NotNull(currentUser, "currentUser"); if (!ModelState.IsValid) { return(View("Update", new UserGroupUpdateViewModel(userGroup, userGroupUpdateCommand))); } UserGroupService.Update(userGroup, userGroupUpdateCommand.UserGroupDto, currentUser); return(RedirectToAction("AllMemberships")); }
public string Rename(string id,string name) { UserGroupService ugs = new UserGroupService(); List<UserGroup> list = ugs.FindAll(); UserGroup ug = new UserGroup(); for (int i = 0; i < list.Count; i++) { if (id == list[i].Id + "") { ug = list[i]; } } ug.Title = name; ugs.Update(ug); return null; }
public async Task <ActionResult> Edit(string userGroupId, GroupUserModel groupUserModel) { try { string accessToken = Session["MicrosoftAccessToken"] as string; var userGroupService = new UserGroupService(accessToken); var userGroup = await userGroupService.GetUserGroupById(userGroupId); userGroup.RoleTypeId = groupUserModel.RoleTypeId; await userGroupService.Update(userGroup); return(RedirectToAction("Index", new { groupId = userGroup.GroupId })); } catch { return(View()); } }
protected void btnOk_Click(object sender, EventArgs e) { UserGroupService service = new UserGroupService(); UserGroup userGroup = new UserGroup { GroupName = txtGroupName.Text }; int id; if (int.TryParse(Request["id"], out id)) { userGroup.GroupId = id; service.Update(userGroup); } else { service.Create(userGroup); } PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }