示例#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,

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

            return View(car);
        }