public async Task AddPetAsync(Pet pet) { Family.Pets.Add(pet); await UpdateFamily(Family); Family = Families.First(f => f.HouseNumber == Family.HouseNumber && f.StreetName.Equals(Family.StreetName)); }
public void RemoveFamily(int HouseNumber, string StreetName) { Family toRemove = Families.First(a => a.HouseNumber == HouseNumber && a.StreetName.Equals(StreetName)); Families.Remove(toRemove); SaveChanges(); }
public async Task AddChildAsync(Child child) { Family.Children.Add(child); await UpdateFamily(Family); Family = Families.First(f => f.HouseNumber == Family.HouseNumber && f.StreetName.Equals(Family.StreetName)); }
public void RemoveAdult(int FamilyId, int AdultId) { Family familyFromToRemove = Families.First(f => f.Id == FamilyId); Adult adultToRemove = familyFromToRemove.Adults.First(a => a.Id == AdultId); int familyIndex = Families.IndexOf(familyFromToRemove); Families[familyIndex].Adults.Remove(adultToRemove); SaveChanges(); }