public void RemoveFromUnconfirmedFriends(User user) { if (!UserFriends.Contains(user)) { throw new Exception($"Cannot remove user {user.Name} from friends list, it does't contains this user "); } UserFriends.Remove(user); }
public void RemoveFromFriends(User friend) { if (Id == friend.Id) { throw new Exception("You can not remove yourself"); } UserFriends.Where(f => f.User.Id == friend.Id || f.Friend.Id == friend.Id) .ToList() .ForEach(userFriend => { UserFriends.Remove(userFriend); }); }