Why do I get All
instead of the Single
result when I do an HTTP request for a web API like this:
I think the second method should be executed but the first one is executed instead:
public IHttpActionResult GetCamps()
{
var camps = _context.CAMPs.ToList()
.Select(Mapper.Map<CAMP, CampDTO>);
return Ok(camps);
}
public IHttpActionResult GetCamp(int campCode)
{
var camp = _context.CAMPs
.SingleOrDefault(c => c.CAMP_CODE == campCode);
if (camp == null)
return NotFound();
return Ok(Mapper.Map<CAMP, CampDTO>(camp));
}