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"));
        }
Ejemplo n.º 2
0
        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"));
        }
Ejemplo n.º 3
0
        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());
        }