public bool AddRoommateToHome(string roommateId, string homeId) { var household = GetHouseholdById(homeId); RoomieRepo roomieRepo = new RoomieRepo(_context); var roommate = roomieRepo.GetRoommate(roommateId); if (household != null) { roommate.HomeId = homeId; //household.Roommates.Add(roommate); _context.SaveChanges(); return(true); } return(false); }
public decimal GetTotalBalance(string userId) { RoomieRepo roomieRepo = new RoomieRepo(_context); List <Roommate> roommies = roomieRepo.GetAllOtherRoommates(userId).ToList(); decimal bal = 0; foreach (Roommate roommie in roommies) { decimal individualBal = GetIndividualRelationshipBalance(userId, roommie.RoommateId); bal += individualBal; } return(bal); }