I have a Web API method that takes two double args:
Repository interface:
public interface IInventoryItemRepository
{
. . .
IEnumerable<InventoryItem> GetDepartmentRange(double deptBegin, double deptEnd);
. . .
}
Repository:
public IEnumerable<InventoryItem> GetDepartmentRange(double deptBegin, double deptEnd)
{
// Break the doubles into their component parts:
int deptStartWhole = (int)Math.Truncate(deptBegin);
int startFraction = (int)((deptBegin - deptStartWhole) * 100);
int deptEndWhole = (int)Math.Truncate(deptEnd);
int endFraction = (int)((deptBegin - deptEndWhole) * 100);
return inventoryItems.Where(d => d.dept >= deptStartWhole).Where(e => e.subdept >= startFraction)
.Where(f => f.dept <= deptEndWhole).Where(g => g.subdept >= endFraction);
}
Controller:
[Route("api/InventoryItems/GetDeptRange/{BeginDept:double}/{EndDept:double}")]
public IEnumerable<InventoryItem> GetInventoryByDeptRange(double BeginDept, double EndDept)
{
return _inventoryItemRepository.GetDepartmentRange(BeginDept, EndDept);
}
When I try to invoke this method, via:
http://localhost:28642/api/inventoryitems/GetDeptRange/1.1/99.99
...I get, "HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
The related methods run fine (other methods on this Controller).