Beispiel #1
0
        private void updateAwlPets(AwlApi api)
        {
            HashSet <Id> found = new HashSet <Id>();

            foreach (AwlPet p in api.data)
            {
                Id id = new Id(ORIGIN, p.unique_id);
                found.Add(id);

                Pet pet = allPets.Get(id);
                if (pet == null)
                {
                    pet = p.Create();
                    allPets.Add(pet);
                }
                else
                {
                    p.Update(pet);
                }
            }

            foreach (Pet pet in allPets.GetAll().Where(p => p.Id.Origin == ORIGIN && !found.Contains(p.Id)))
            {
                pet.Status = Status.Adopted;
            }
        }
Beispiel #2
0
        private void updateRspcaPets(IEnumerable <RspcaPet> api)
        {
            HashSet <Id> found = new HashSet <Id>();

            foreach (RspcaPet p in api.Where(shelterAllowed))
            {
                Id id = new Id(ORIGIN, p.api_id);
                found.Add(id);

                Pet pet = allPets.Get(id);
                if (pet == null)
                {
                    pet = p.Create();
                    allPets.Add(pet);
                }
                else
                {
                    p.Update(pet);
                }
            }

            foreach (Pet pet in allPets.GetAll().Where(p => p.Id.Origin == ORIGIN && !found.Contains(p.Id)))
            {
                pet.Status = Status.Adopted;
            }
        }