Привет. Я пытаюсь взять текстовые поля из формы и вставить их в качестве параметра в контроллер. Вот моя форма
@{
ViewData["Title"] = "AddCar";
}
<h1>AddCar</h1>
<form asp-action="AddCar" method="post">
<div class="text-danger">@Validation.errorMessage</div>
<label>Make/Model: </label><br />
<input type="text" name="makeModel" value="Buick" /><br />
<label>Year: </label><br />
<input type="text" name="year" value="1998" /><br />
<label>Color: </label><br />
<input type="text" name="color" value="Red" /><br />
<label>Price: </label><br />
<input type="text" name="price" value="123123" /><br />
<label>Milage: </label><br />
<input type="text" name="milage" value="112312" /><br />
<button type="submit">Search</button>
</form>
, а это мой контроллер
[HttpPost]
[Route("[area]/AddCar/{makeModel}/{milage}/{year}/{color}/{price}")]
public IActionResult AddCar(String makeModel, String milage, String year, String color, String price)
{
Car car = new Car(year, makeModel, price, milage, color);
return View();
}