Exemplo n.º 1
0
        public void Update(Pet pet)
        {
            pet.Name           = name;
            pet.Location       = loc("location", location).ToString();
            pet.Type           = loc("type", type).ToString();
            pet.Sex            = PetUtils.ParseSex(gender);
            pet.Breed          = breed;
            pet.BreedSecondary = breed_secondary;
            pet.Age            = age_actual;
            pet.Lifestyle      = lifestyle;
            pet.Training       = loc("training", training).ToString();
            pet.Status         = parseStatus();

            var actualAnimals  = animalHandling();
            var currentAnimals = pet.OtherAnimals;

            foreach (string animal in currentAnimals.Except(actualAnimals))
            {
                pet.RemoveOtherAnimal(animal);
            }
            foreach (string animal in actualAnimals.Except(currentAnimals))
            {
                pet.AddOtherAnimal(animal);
            }
        }