Beispiel #1
0
        public ActionResult AddGroupInvite(GroupItem groupItem, int userID)
        {
            ModelState["Name"].Errors.Clear();
            Group outGroup = GroupManager.GetGroupByID(groupItem.ID, GroupManager.GroupRelatedData.UsersAndGroupInvite);

            if (ModelState.IsValid && !UsersToGroupManager.IsMember(groupItem.GroupInviteUserMail, groupItem.ID))
            {
                GroupInvite groupInvite = new GroupInvite();
                groupInvite.GroupID  = groupItem.ID;
                groupInvite.UserMail = groupItem.GroupInviteUserMail;

                string url = Utils.AppUtils.AppDomainPath + ((UserManager.GetByUsername(groupItem.GroupInviteUserMail) != null) ? "User/Login" : "User/Register");

                GroupInviteManager.Add(groupInvite);
                Utils.NotificationManager.SendEmail(//string.Format("{0} {1}", outGroup.User.FirstName, outGroup.User.LastName),
                    Core.SessionManager.UserFullName,
                    //outGroup.User.UserName,
                    User.Identity.Name,
                    groupInvite.UserMail,
                    App_GlobalResources.Mail.Subject,
                    string.Format(App_GlobalResources.Mail.Body, outGroup.User.FirstName, url));

                return(RedirectToAction("GroupDetails", new { id = groupItem.ID }));
            }

            GroupItem outGroupitem = outGroup.ToGroupItem();

            outGroupitem.GroupInviteUserMail = groupItem.GroupInviteUserMail;
            ModelState.AddModelError("GroupInviteUserMail", App_GlobalResources.Common.UserIsInviteGroup);
            return(View("GroupDetails", outGroupitem));
        }
Beispiel #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 }));
        }
Beispiel #3
0
 public ActionResult ClearGroupInvite(int id, int groupID)
 {
     GroupInviteManager.Remove(id);
     return(RedirectToAction("GroupDetails", "Group", new { id = groupID }));
 }
Beispiel #4
0
 public ActionResult CancelGroupInvite(int id)
 {
     GroupInviteManager.Remove(id);
     return(RedirectToAction("Profile", "User", new { id = SessionManager.UserID }));
 }