Esempio n. 1
0
        public void Adopt(int animalId, Adopter person)
        {
            AnimalRepository theseAnimals = new AnimalRepository();
            Animal           thisAnimal   = ourAnimals.Where(a => a.AnimalId == animalId).Select(a => a).Single();

            ourAnimals.Remove(thisAnimal);
            UpdateAdopterInfoWithAnimal(person, thisAnimal);
            theseAnimals.UpdateAnimalAdoption(thisAnimal.AnimalId);
        }
Esempio n. 2
0
        public AnimalControl()
        {
            AnimalRepository animals = new AnimalRepository();

            ourAnimals = animals.GetAllAnimals();
            RoomRepository rooms = new RoomRepository();

            ourRooms = rooms.GetAllRoomsWithAnimalNames();
        }
Esempio n. 3
0
        public Animal(string name, string type, double price, DateTime arrival, string color, int height, int weight, int activityLevel, int age, DateTime?shotsDate, string foodType, int foodConsumptionPerWeek, int dishSize, int spaceNeeds)
        {
            this.name = name;
            this.type = type;
            if (arrival != null)
            {
                this.arrival = arrival;
            }
            else
            {
                arrival = DateTime.Now;
            }
            this.price  = price;
            theseTraits = new Traits(color, height, weight, activityLevel);
            thisHealth  = new Health(age, shotsDate, foodType, foodConsumptionPerWeek, dishSize, spaceNeeds);
            AnimalRepository myAnimalRepository = new AnimalRepository();

            myAnimalRepository.InsertAnimal(this);
        }