Example #1
0
        public List <FriendRequests> GetRequests(string client)
        {
            List <FriendRequests> frnd = FriendsRequests.Where(i => (i.From == client && i.isConfirmed == false) ||
                                                               (i.To == client && i.isConfirmed == false)).ToList();

            return(frnd);
        }
Example #2
0
 public void AcceptFriendsRequest(string from, string to)
 {
     FriendRequests[] frnd = FriendsRequests.Where(i => i.From == from && i.To == to).ToArray();
     if (frnd.Length != 0 && !frnd[0].isConfirmed)
     {
         frnd[0].isConfirmed = true;
         FriendsRequests.Update(frnd[0]);
         SaveChanges();
     }
 }
Example #3
0
 public void SendFriendsRequest(string from, string to)
 {
     FriendRequests[] frnd = FriendsRequests.Where(i => i.From == from && i.To == to).ToArray();
     if (frnd.Length == 0)
     {
         FriendRequests req = new FriendRequests {
             From        = from,
             To          = to,
             isConfirmed = false,
         };
         FriendsRequests.Add(req);
         SaveChanges();
     }
 }