0
I want to be able to fetch my items by name and this function is also a get request only it already has other requests Get wanted to understand how to get as many as I want
I understand the program doesn’t know which one to go to
of that mistake here:
An unhandled Exception occurred while Processing the request. Ambiguousmatchexception: The request Matched Multiple endpoints. Matches:
challenge.Controllers.Itemcontroller.Get (challenge) challenge.Controllers.Itemcontroller.Search (challenge) Microsoft.AspNetCore.Routing.Matching.Defaultendpointselector.Reportambiguity(Candidateset candidates)
[HttpGet]
public ActionResult<List<Item>> Get()
{
return _itemService.Get();
}
[HttpGet("{id}", Name = "GetItem")]
public ActionResult<Item> Get(string id)
{
var item = _itemService.Get(id);
if (item == null)
{
return NotFound();
}
return item;
}
[HttpGet("{name}")]
public ActionResult<List<Item>> Buscar(string name)
{
var item = _itemService.Buscar(keyword);
if(item == null)
{
return NotFound();
}
return _itemService.Get();
}
Thank you very much Lucas, I was doing similar but did not give the result I expected, you helped me a lot, thank you!!!!
– Robson Junior