Example #1
0
        public async Task <IActionResult> OnGetAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Manufactures = await _context.Manufactures.FirstOrDefaultAsync(m => m.Ford == id);

            if (Manufactures == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #2
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Manufactures = await _context.Manufactures.FindAsync(id);

            if (Manufactures != null)
            {
                _context.Manufactures.Remove(Manufactures);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Example #3
0
 PhoneTypeChecker(Manufactures manu)
 {
     if (manu == Manufactures.Samsung)
     {
         SamsungFactory s = new SamsungFactory();
         factory = s;
         CheckProducts(factory);
     }
     else if (manu == Manufactures.HTC)
     {
         HTCFactory htc = new HTCFactory();
         factory = htc;
         CheckProducts(factory);
     }
     else if (manu == Manufactures.Nokia)
     {
         NokiaFactory n = new NokiaFactory();
         factory = n;
         CheckProducts(factory);
     }
 }
Example #4
0
        static void Main(string[] args)
        {
            PhoneTypeChecker check = new PhoneTypeChecker();

            Manufactures selection = new Manufactures();

            Console.WriteLine("What brand of smart phone would you like to view?");
            Console.WriteLine(" Samsung");
            Console.WriteLine(" HTC");
            Console.WriteLine(" Nokia");
            Console.WriteLine("press 's' for 'Samsung', 'h' for 'HTC', and 'n' for 'Nokia'");
            string phone;

            phone = Console.ReadLine();

            if (phone == "s")
            {
                selection = Manufactures.Samsung;
            }

            else if (phone == "h")
            {
                selection = Manufactures.HTC;
            }

            else if (phone == "n")
            {
                selection = Manufactures.Nokia;
            }
            else

            {
                Console.WriteLine("\nIncorrect answer please try again!");
            }
            switch (selection)
            {
            }
        }