public void DeleteFriend(int userid, string ownername) { var user = context.Users.Where(x => x.Username == (ownername)).FirstOrDefault(); int userId = user.Id; var friend = context.connections.Where(x => x.UserIdOne == userid && x.UserIdTwo == userId).FirstOrDefault(); context.Remove(friend); context.SaveChanges(); }
public void Delete(string id) { try { var friendRequest = context.FriendRequests.Find(id); if (friendRequest == null) { return; } context.Remove(friendRequest); context.SaveChanges(); } catch (Exception e) { throw e; } }