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"); } }
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); }