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