【发布时间】:2018-01-10 09:22:50
【问题描述】:
我有 js 代码,我通过参数将数据传递给 repo 方法。
这里是repo方法:
public List<SpeedLimitViewModel> GetSpeedData(decimal imei, DateTime start, DateTime end)
{
using (TraxgoDB ctx = new TraxgoDB())
{
List<SpeedLimitViewModel> alldata = new List<SpeedLimitViewModel>();
var alllogs = ctx.Logging.OrderByDescending(x => x.LogID).ToList();
for (int i = 1; i < alllogs.Count; i++)
{
alldata.Add(new SpeedLimitViewModel
{
Imei= alllogs[i].Imei,
Latitude2 = alllogs[i].Latitude,
Longitude2 = alllogs[i].Longitude,
Speed = alllogs[i].Speed
});
}
return alldata;
}
}
我在控制器中这样调用这个方法:
public JsonResult SpeedData()
{
var speeddata = repoEntities.GetSpeedData();
return Json(speeddata.ToArray(), JsonRequestBehavior.AllowGet);
}
但我有错误
严重性代码描述项目文件行抑制状态 错误 CS7036 没有给出与 'ReportsRepositoryEntities.GetSpeedData(decimal, DateTime, DateTime)' Traxgo.TrackerWeb C:\Users\EugeneSukhomlyn\Source\Workspaces\TraxgoWeb\Traxgo.TrackerWeb\ 所需的形式参数 'imei' 相对应的参数Controllers\ReportsController.cs 94 活动
我的问题在哪里?
【问题讨论】:
-
您的方法有 3 个参数 - 您需要在调用该方法时为它们传递值(尽管您似乎从未使用过它们,所以您可以删除它们)
标签: c# asp.net asp.net-mvc