I have a controller class as below:
[Route("api/[controller]")]
public class ItemController : Controller
{
//GET api/item?employId=1009
[HttpGet]
public List<ItemViewModel> GetByEmployId([FromQuery]long employId) {
return new List<ItemViewModel>() {
new ItemViewModel(),
new ItemViewModel(),
new ItemViewModel()
};
}
// GET api/item?managerId=1009
[HttpGet]
public List<ItemViewModel> GetByManagerId([FromQuery]long managerId) {
return new List<ItemViewModel>();
}
}
For the first URL (http://localhost/api/item?employId=1), the web api can return results. But for the second URL (http://localhost/api/item?managerId=2), the web api return error with HTTP code 500. Can someone help on why this happens? Thanks.
For some reason, I can't debug with the web api project.
http://localhost/api/manager/2/item