public IActionResult Add() { CarHelperModel model = new CarHelperModel { MakeCollection = this.carService.GetMakes(), Parts = this.partService.GetAll() }; return(this.View(model)); }
public IActionResult Add(CarHelperModel model) { if (!this.ModelState.IsValid) { model.MakeCollection = this.carService.GetMakes(); model.Parts = this.partService.GetAll(); return(this.View(model)); } this.carService.Add(model.Car.Make, model.Car.Model, model.Car.TravveledDistance, model.Car.Parts); return(this.Redirect($"/Cars/{model.Car.Make}")); }