Web API获取方法未响应

时间:2019-07-17 18:38:14

标签: entity-framework asp.net-web-api

我正在.Net Web-api项目上工作,我有一个Car控制器,该控制器具有带字符串参数的get方法。

当我使用该方法时,它将返回所有数据(所有汽车)。

我试图用“ Where(...)”来做,但是没有帮助 我也删除了模型和控制器(我当然备份了) 并且它起作用了(它在其他控制器上..),但是我每次都无法删除模型, 除此之外,当我尝试获取

时,调试器不会响应
        {
            Car car = LuxuryWheelsDB.Cars.FirstOrDefault(s=>s.Model==model);
            if (car != null)
            {
                return Request.CreateResponse(HttpStatusCode.OK, car);
            }
            return Request.CreateResponse(HttpStatusCode.NotFound);
        }
public partial class Car 
{ 
    public string Manufacturer { get; set; } 
    public string Model { get; set; } 
    public Nullable<double> Price_for_day { get; set; } 
    public Nullable<int> Penalty_price__day_ { get; set; } 
    public Nullable<int> Manufacturer_year { get; set; } 
    public string Gear { get; set; } 
}

0 个答案:

没有答案