【发布时间】:2020-01-27 12:02:44
【问题描述】:
显示“此异步方法缺少等待”的警告。请建议在我的异步方法中添加等待的位置?
public async Task<IHttpActionResult> GetEmployeeDetails(string id,string StartDate, string EndDate)
{
DateTime sd = Convert.ToDateTime(StartDate);
DateTime ed = Convert.ToDateTime(EndDate);
using (EmployeeEntities db = new EmployeeEntities ())
{
try
{
return Ok(db.employees.Where(x => x.TimeStamp >= sd && x.TimeStamp <= ed && x.DeviceImei ==id).OrderByDescending(x => x.id).ToListAsync());
}
catch (Exception)
{
return BadRequest("Sorry Error Found!!!");
}
}
}
【问题讨论】:
标签: asp.net-web-api2