Exemple #1
0
        public static bool MoveContact(this Users um, Users User, Users Friend, FriendGroup NewGroup)
        {
            FriendMap FriendMap = db.FriendMap
                                  .Include(m => m.User)
                                  .Include(m => m.Friend)
                                  .Include(m => m.FriendGroup)
                                  .FirstOrDefault(
                m => m.User.UserID == User.UserID &&
                m.Friend.UserID == Friend.UserID
                );

            FriendMap.FriendGroup = NewGroup;

            return(FriendMap.Update());
        }
Exemple #2
0
        public static bool RequestProcess(this Users um, Users User, Users Friend, FriendGroup Group, bool IsAccepted, bool IsIgnored)
        {
            FriendMap Request = db.FriendMap
                                .Include(m => m.User)
                                .Include(m => m.Friend)
                                .FirstOrDefault(
                m => m.User.UserID == Friend.UserID &&
                m.Friend.UserID == User.UserID
                );

            Request.IsAccepted = IsAccepted;
            Request.IsIgnored  = IsIgnored;

            bool MapFriendSuccess = false;

            if (IsAccepted)
            {
                FriendMap ConnectFriend = new FriendMap
                {
                    User        = User,
                    Friend      = Friend,
                    FriendGroup = Group,
                    IsAccepted  = true,
                    IsIgnored   = false
                };

                MapFriendSuccess = ConnectFriend.New();
            }

            if (IsAccepted && !MapFriendSuccess)
            {
                return(false);
            }

            return(Request.Update());
        }