Ошибка AmbiguousMatchException: The request matched multiple endpoints
У меня в контроллере 3 метода
[HttpPost]
public IActionResult AddReserv([FromForm]ReservModel reserv)
{
if (User.Identity.IsAuthenticated)
{
using (var connection = _db.Database.GetDbConnection())
{
connection.Open();
using (var command = connection.CreateCommand())
{
var rand = new Random();
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "AddReserv";
command.Parameters.Add(new SqlParameter("UserName", User.Identity.Name));
command.Parameters.Add(new SqlParameter("Place", reserv.Place));
command.Parameters.Add(new SqlParameter("StartDate", reserv.StartDate));
command.Parameters.Add(new SqlParameter("EndDate", reserv.EndDate));
command.ExecuteNonQuery();
}
}
}
else
{
//пользователь не авторизован
}
return RedirectToAction("Index", "Home");
}
[HttpPost]
public async Task<IActionResult> DeleteReserv(int id)
{
var reserv = await _db.ReservPlaces.FindAsync(id);
if (reserv == null)
{
return NotFound();
}
_db.ReservPlaces.Remove(reserv);
await _db.SaveChangesAsync();
return RedirectToAction("Index", "Home");
}
[HttpPost]
public void GetPlaces([FromForm]ReservModel dt)
{
//
}
Форма отправки значений
div class="modal" id="modal-wrapper" style="display: none;">
<form asp-action="AddReserv" asp-controller="CreateReserv" asp-anti-forgery="true" class="modal-content animate">
<div class="imgcontainer">
<span title="Close PopUp" class="close" onclick="document.getElementById('modal-wrapper').style.display='none'">×</span>
<h2 style="text-align: center;">Задать время работы</h2>
</div>
<div class="container">
<div class="caption">Место</div>
<div>
<input id="placeNum" value="" type="text" asp-for="Reserv.Place" readonly style="padding:12px 20px; width: 50%" />
</div>
<div class="caption">Начало</div>
<input class="datepicker-here " data-timepicker="true" data-date-format="dd.mm.yyyy" data-time-format="hh:ii" asp-for="Reserv.StartDate" />
<div class="caption">Завершение</div>
<input class="datepicker-here" data-timepicker="true" data-date-format="dd.mm.yyyy" data-time-format="hh:ii" asp-for="Reserv.EndDate" />
<div />
<button type="submit" class="btn btn-primary btn-lg">Зарезервировать</button>
</div>
</form>
При отсылки формы получаю ошибку
AmbiguousMatchException: The request matched multiple endpoints. Matches:
JobPLaceReserv.Controllers.CreateReservController.AddReserv (JobPLaceReserv)
JobPLaceReserv.Controllers.CreateReservController.DeleteReserv (JobPLaceReserv)
JobPLaceReserv.Controllers.CreateReservController.GetPlaces (JobPLaceReserv)