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()); }
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()); }