/* DESCRIPTION: The User declines another User from Household if he or she owns the HouseHold NOTES: A User owns a HouseHold if the HouseHold is stored in their List Households. The User must be in that HouseHold's Request. The HouseHold will remove the Request afterward. MARKED: Possibly try to delete the user's requested HouseHold inside this this function. */ public void DeclineRequest(User user, HouseHold household) { var request = household.Requests.FirstOrDefault(x => x.User.Id == user.Id && x.HouseHold.Id == household.Id); if (request != null) { household.RemoveRequest(request); user.MyRequests.Remove(request); } }
/* DESCRIPTION: User will accept another User's request for the HouseHold if they own it. NOTES: A User owns a HouseHold if the HouseHold is stored in their List Households. The User must be in that HouseHold's Request. The HouseHold will remove the Request afterward. MARKED: Possibly try to delete the user's requested HouseHold inside this this function. */ public void AcceptRequest(User user, HouseHold household) { var request = household.Requests.FirstOrDefault(x => x.User.Id == user.Id && x.HouseHold.Id == household.Id); if (request != null) { household.AddRoommate(user); user.MyRequests.Remove(request); household.RemoveRequest(request); } }