I have js code where I pass data to repo method via parameters.
Here is repo method:
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;
}
}
And I call this method in controller like this:
public JsonResult SpeedData()
{
var speeddata = repoEntities.GetSpeedData();
return Json(speeddata.ToArray(), JsonRequestBehavior.AllowGet);
}
But I have error
Severity Code Description Project File Line Suppression State Error CS7036 There is no argument given that corresponds to the required formal parameter 'imei' of 'ReportsRepositoryEntities.GetSpeedData(decimal, DateTime, DateTime)' Traxgo.TrackerWeb C:\Users\EugeneSukhomlyn\Source\Workspaces\TraxgoWeb\Traxgo.TrackerWeb\Controllers\ReportsController.cs 94 Active
Where is my problem?
public JsonResult SpeedData(decimal imei, DateTime start, DateTime end)
{
var speeddata = repoEntities.GetSpeedData(imei, start, end);
return Json(speeddata.ToArray(), JsonRequestBehavior.AllowGet);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With