我在搜索日期列表时遇到问题,搜索结果没有出现。可变约会日期已作为日期时间保存在数据库中。这是我目前在我的控制器中的代码:
public ActionResult Index(DateTime SearchDate)
{
var query = from a in db.AppointmentProcedures
where a.BookingStatus == false
orderby a.AppointmentStartTime
select a;
if (SearchDate != null)
{
query = from a in db.AppointmentProcedures
orderby a.AppointmentDate
where a.AppointmentDate <= SearchDate
select a;
}
return View(query);
}
这是我继续遇到的错误:
The model item passed into the dictionary is of type
'System.Data.Entity.Infrastructure.DbQuery`1[System.DateTime]', but this dictionary
requires a model item of type
'System.Collections.Generic.IEnumerable`1[LaserculptFinal.Models.AppointmentProcedure]'