Пример #1
0
 public ActionResult AddNewCar(Car newCar)
 {
     ViewBag.Message = "Add a new Car!";
     if (ModelState.IsValid)
     {
         DBCarRepository car = new DBCarRepository();
         car.AddCar(newCar);
         return RedirectToAction("Index");
     }
     else
     {
         return View("Add");
     }
 }
Пример #2
0
        public void TestAddToRepo()
        {
            Car c = new Car()
            {
                Description = "Spam",
                Title = "Spam",
                Year = "1987",
                Make = "Nissan",
                Model = "Stanza",
                Price = 9999.00M,
                ImageUrl = "http://carphotos.cardomain.com/ride_images/1/1287/3601/3216800003_large.jpg"
            };

            var _repo = new DBCarRepository();
            _repo.AddCar(c);
        }