public static CarDomainModel Create(CarViewModel carView) { return new CarDomainModel { Id = carView.Id, Make = carView.Make, Model = carView.Model, Available = carView.Available, SegmentId = carView.SegmentId, }; }
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); }
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."); }
public static CarDomainModel CreateCarDomain(this CarViewModel carView) { return(Create(carView)); }
public ActionResult Create (CarViewModel car) { if (ModelState.IsValid) { _carHandler.Add(car.CreateCarDomain()); _carHandler.Commit(); return RedirectToAction("Index"); } return View(car); }