Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("1. marque:" + "\n" + "2. type:" + "\n" + "3. noPlaque:" + "\n" + "4. prix:" + "\n");
            Console.WriteLine("bateau");

            Bateau a = new Bateau("Princecraft", "barque");

            a.Eau = ("green bit");

            Console.WriteLine(a);
            Console.WriteLine("\n");
            Console.WriteLine("Avion");

            Avion aa = new Avion("Bonbardier", "Plane", "pl-123", "2333333333$");


            Console.WriteLine(aa);
            Console.WriteLine("\n");
            Console.WriteLine("Auto");

            Auto mo = new Auto("chevrolet", "cruze", "N45 P2K", "23 000$");


            Console.WriteLine(mo);
            Console.ReadLine();
        }
        public async Task <IActionResult> Edit(int id, Bateau bateau)
        {
            if (id != bateau.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bateau);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BateauExists(bateau.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["TypeBateauID"] = new SelectList(_context.TypesBateaux, "TypeBateauID", "TypeBateauID", bateau.TypeBateauID);
            return(View(bateau));
        }
Example #3
0
        static void Main(string[] args)
        {
            Avion Av = new Avion("Boeing", 10000, 2010);

            Av.Marche();

            Velo Ve = new Velo("", 0, 0);

            Ve.Marche();

            Bateau Ba = new Bateau("", 0, 0);

            Ba.Marche();

            Camion Ca = new Camion("", 0, 0);

            Ca.Marche();

            Console.ReadLine();
        }
        public async Task <IActionResult> Create(Bateau bateau)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(bateau);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            ViewData["TypeBateauID"] = new SelectList(_context.TypesBateaux, "TypeBateauID", "TypeBateauID", bateau.TypeBateauID);
            return(View(bateau));
        }