public IActionResult ApplyMB(Vehicle v) { if (ModelState.IsValid) { // Add to database VehicleDB.Apply(v); // Alert successs ViewData["Success"] = "Registration was successful!"; return(View()); } return(View()); }
public IActionResult Apply(IFormCollection data) { Vehicle v = new Vehicle() { FullName = data["full-name"], Make = data["make"], Model = data["model"], Year = Convert.ToInt32(data["year"]), Miles = Convert.ToInt32(data["miles"]) }; VehicleDB.Apply(v); ViewData["Success"] = "Registration was successful!"; //ADD TO DATABASE HERE!!!! return(View()); }