相关疑难解决方法(0)

为什么我的带有双args的Web API方法没有被调用?

我有一个Web API方法,需要两个双参数:

存储库界面:

public interface IInventoryItemRepository
{
. . .
    IEnumerable<InventoryItem> GetDepartmentRange(double deptBegin, double deptEnd);
. . .
}
Run Code Online (Sandbox Code Playgroud)

库:

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);
}
Run Code Online (Sandbox Code Playgroud)

控制器: …

c# rest double asp.net-web-api-routing

7
推荐指数
2
解决办法
3418
查看次数

标签 统计

asp.net-web-api-routing ×1

c# ×1

double ×1

rest ×1