Пример #1
0
        public ActionResult GroupCreate(GroupItem model)
        {
            ModelState["GroupInviteUserMail"].Errors.Clear();

            if (ModelState.IsValid)
            {
                model.OwnerID = SessionManager.UserID;
                Group outGroup = GroupManager.Create(model.ToGroup());

                if (outGroup != null)
                {
                    UsersToGroup addUsersToGroup = new UsersToGroup();
                    addUsersToGroup.GroupID     = outGroup.ID;
                    addUsersToGroup.UserID      = outGroup.OwnerID;
                    addUsersToGroup.GroupRoleID = (int)DML.Enums.GroupRoles.Moderator;
                    UsersToGroupManager.Add(addUsersToGroup);
                    return(RedirectToAction("GroupDetails", "Group", new { id = outGroup.ID }));
                }
                else
                {
                    ModelState.AddModelError("Name", App_GlobalResources.Common.GroupIsCreate);
                    return(View(model));
                }
            }

            return(View(model));
        }
Пример #2
0
        public ActionResult JoinAnGroup(int groupID, int id)
        {
            UsersToGroup addUsersToGroup = new UsersToGroup();

            addUsersToGroup.GroupID     = groupID;
            addUsersToGroup.UserID      = Core.SessionManager.UserID;
            addUsersToGroup.GroupRoleID = (int)DML.Enums.GroupRoles.Player;
            UsersToGroupManager.Add(addUsersToGroup);

            GroupInviteManager.Remove(id);

            return(RedirectToAction("Profile", "User", new { id = Core.SessionManager.UserID }));
        }