コード例 #1
0
        public static bool AddFriend(this Users um, Users User, Users Friend, FriendGroup Group)
        {
            FriendMap newFriend = new FriendMap
            {
                User        = User,
                Friend      = Friend,
                FriendGroup = Group
            };

            return(newFriend.New());
        }
コード例 #2
0
        public static bool RemoveContact(this Users um, Users User, Users Friend)
        {
            FriendMap FriendMap = db.FriendMap
                                  .Include(m => m.User)
                                  .Include(m => m.Friend)
                                  .FirstOrDefault(
                m => m.User.UserID == User.UserID &&
                m.Friend.UserID == Friend.UserID
                );

            return(FriendMap.Remove());
        }
コード例 #3
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());
        }
コード例 #4
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());
        }
コード例 #5
0
 public static FriendMap Get(this FriendMap fm, int FriendMapID)
 {
     return(db.FriendMap
            .FirstOrDefault(m => m.FriendMapID == FriendMapID));
 }