Exemplo n.º 1
0
        public void TestEditRepo()
        {
            var _repo = new DBCarRepository();
            var car = _repo.GetAllCars().FirstOrDefault(x => x.Make == "Nissan" && x.Model == "Stanza" && x.Year == "1987");

            if (car != null)
            {
                Car c = new Car()
                {
                    Id = car.Id,
                    Description = "Well, well, well, what do we have here? A car with four doors? Check. A car with a solid roof? Check. A car with rearview mirrors so you can really connect with that Pearl Jam song? Psh, DOUBLE CHECK. We here at SWCG understand that your discriminating tastes demand that you're able to stand up to authority in style, and this 1987 Nissan Stanza virtually screams: \"Live free or die!\". Rest assured, the seat belts will help ensure that you can live free AND live. That's the SWCG guarentee. You're welcome. ",
                    Title = "PATRIOTIC Nissan Stanza from the year of our Lord 1987",
                    Year = "1987",
                    Make = "Nissan",
                    Model = "Stanza",
                    Price = 9999.00M,
                    ImageUrl = "http://carphotos.cardomain.com/ride_images/1/1287/3601/3216800003_large.jpg"
                };

                _repo.EditCar(c);
            }
        }
Exemplo n.º 2
0
 public ActionResult EditCar(Car editCar)
 {
     ViewBag.Message = "Edit your car!";
     if (ModelState.IsValid)
     {
         DBCarRepository car = new DBCarRepository();
         car.EditCar(editCar);
         return RedirectToAction("Index");
     }
     else
     {
         return View("Edit");
     }
 }