Example #1
0
     public string Create (CarViewModel car)
     {
         if (ModelState.IsValid)
         {
             if (!String.IsNullOrEmpty(car.Make) && !String.IsNullOrEmpty(car.Model))
             {
                 _carHandler.Add(car.CreateCarDomain());
                 _carHandler.Commit();
                 //return RedirectToAction("Index");
                 return ("Thank you " + car.Make +"  " + car.Model + ". Record Saved.");
 
             }
         }
         return ("Please complete the form.");
     }
Example #2
0
 public ActionResult Edit (CarViewModel car)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(car).State = EntityState.Modified;
         //db.SaveChanges();
         _carHandler.Update(car.CreateCarDomain());
         _carHandler.Commit();
         return RedirectToAction("Index");
     }
     return View(car);
 }
Example #3
0
        public ActionResult Create (CarViewModel car)
        {
            if (ModelState.IsValid)
            {
                _carHandler.Add(car.CreateCarDomain());
                _carHandler.Commit();
                return RedirectToAction("Index");
            }

            return View(car);
        }