Esempio n. 1
0
            public static CarDomainModel Create(CarViewModel carView)
            {
                return new CarDomainModel
                {
                    Id = carView.Id,
                    Make = carView.Make,
                    Model = carView.Model,
                    Available = carView.Available,
                    SegmentId = carView.SegmentId,

                };
            }
Esempio n. 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);
 }
Esempio n. 3
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.");
     }
Esempio n. 4
0
 public static CarDomainModel CreateCarDomain(this CarViewModel carView)
 {
     return(Create(carView));
 }
Esempio n. 5
0
        public ActionResult Create (CarViewModel car)
        {
            if (ModelState.IsValid)
            {
                _carHandler.Add(car.CreateCarDomain());
                _carHandler.Commit();
                return RedirectToAction("Index");
            }

            return View(car);
        }