コード例 #1
0
ファイル: FamilyServiceClient.cs プロジェクト: leldenor/DNP1
        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));
        }
コード例 #2
0
ファイル: FileContext.cs プロジェクト: leldenor/Assignment
        public void RemoveFamily(int HouseNumber, string StreetName)
        {
            Family toRemove = Families.First(a => a.HouseNumber == HouseNumber && a.StreetName.Equals(StreetName));

            Families.Remove(toRemove);
            SaveChanges();
        }
コード例 #3
0
ファイル: FamilyServiceClient.cs プロジェクト: leldenor/DNP1
        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));
        }
コード例 #4
0
        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();
        }