Exemplo n.º 1
0
        public IActionResult Add_finish(string Name, string Breed, string type)
        {
            Pet new_pet = new Pet();

            switch (type)
            {
            case "Dog":
                new_pet = new Dog(Name, Breed);
                break;

            case "Cat":
                new_pet = new Cat(Name, Breed);
                break;
            }
            Petshop.AddPet(new_pet);
            return(View("Add_finish", new_pet));
        }
Exemplo n.º 2
0
        public static void Main()
        {
            Dog sharo = new Dog("Sharo", "");
            Cat catya = new Cat("Katya", "I said Miauu Miau!");
            Dog rex   = new Dog("Rex", "I said Bauuu Bauu Bauuu!");

            Petshop.AddPet(sharo);
            Petshop.AddPet(catya);
            Petshop.AddPet(rex);

            //Console.WriteLine(sharo.Introduce());
            //Console.WriteLine(catya.Introduce());
            //Console.WriteLine(rex.Introduce());
            try
            {
                Console.WriteLine(Petshop.IntorduceAll());
            }
            catch
            {
            }
        }