public ActionResult Create(UserGroupCreateCommand userGroupCreateCommand, User currentUser) { Require.NotNull(currentUser, nameof(currentUser)); if (!ModelState.IsValid) { UserGroupCreateViewModel userGroupCreateViewModel = GetFinancialBrokerPoolCreateViewModel(userGroupCreateCommand); return(View(userGroupCreateViewModel)); } // TODO: Initiale Nutzer! UserGroupService.Create(userGroupCreateCommand.UserGroupDto, new Dictionary <User, UserGroupMembershipType>(), currentUser); return(RedirectToAction("Index")); }
public ActionResult Create(UserGroupCreateCommand userGroupCreateCommand, User currentUser) { Require.NotNull(currentUser, nameof(currentUser)); if (!ModelState.IsValid) { UserGroupCreateViewModel userGroupCreateViewModel = new UserGroupCreateViewModel(userGroupCreateCommand); return(View(userGroupCreateViewModel)); } /*Der Ersteller der Gruppe ist initial Administrator*/ Dictionary <User, UserGroupMembershipType> initialUsers = new Dictionary <User, UserGroupMembershipType>(); initialUsers.Add(currentUser, UserGroupMembershipType.Administrator); UserGroupService.Create(userGroupCreateCommand.UserGroupDto, initialUsers, currentUser); return(RedirectToAction("AllMemberships")); }
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()); }