public ActionResult Create([Bind(Include = "ID,MakeID,Name,Abrv,inStock")] ModelView modelView) { if (ModelState.IsValid) { vehicleService.CreateVehicleModel(modelView); return(RedirectToAction("Index")); } ViewBag.MakeID = new SelectList(vehicleService.GetAllVehicleMakes(), "ID", "Name", modelView.MakeID); return(View(modelView)); }
public ActionResult Create([Bind(Include = "ID,MakeID,ModelName,ModelAbbreviation")] VehicleModel vehicleModel) { if (ModelState.IsValid) { vehicleService.CreateVehicleModel(vehicleModel); return(RedirectToAction("Index")); } //dropdown list ViewBag.MakeID = vehicleService.GetAllVehicleMake(); return(View(vehicleModel)); }
public ActionResult Create([Bind(Include = "VehicleModelId,VehicleMakeId,VehicleModelName,VehicleModelAbrv")] ViewVehicleModel vehicleModel) { if (ModelState.IsValid) { //vehicleModel.VehicleMakeId = 4; vehicleservice.CreateVehicleModel(vehicleModel); return(RedirectToAction("Index")); } ViewBag.VehicleMakeId = vehicleservice.getAll().ToList(); return(View(vehicleModel)); }
public ActionResult Create([Bind(Include = "VehicleModelId,VehicleMakeId,Name,Abrv")] VehicleModelViewModel vehicleModelView) { if (ModelState.IsValid) { vehicleModelView.VehicleModelId = Guid.NewGuid(); vehicleService.CreateVehicleModel(vehicleModelView); return(RedirectToAction("Index")); } ViewBag.VehicleMakeId = new SelectList(vehicleService.GetAllVehicleMakes(), "Id", "Name", vehicleModelView.VehicleMakeId); return(View(vehicleModelView)); }