我目前正在尝试通过API搜索查询实现TypeAhead插件。下面的代码是我从一个肮脏的Mosh(https://github.com/mosh-hamedani/vidly-mvc-5/blob/master/Vidly/Controllers/Api/CustomersController.cs)类收到的摘录。实施以下代码后,我收到的错误是>>
无法隐式转换类型'System.Linq.Iqueryable'到System.Data.Entity.DbSet”。存在显式转换(您是否缺少演员)?
此行在此代码上发生
vmrsQuery = vmrsQuery.Where(c => c.Description.Contains(query));
其他人是否有解决方法,以使其正常运行?
public IHttpActionResult GetVMRS(string query = null)
{
var vmrsQuery = _context.VMRS;
if (!String.IsNullOrWhiteSpace(query))
vmrsQuery = vmrsQuery.ToList().Where(c => c.Description.Contains(query));
var vmrsDtos = vmrsQuery
.ToList()
.Select(Mapper.Map<VMRS, VMRSDto>);
return Ok(vmrsDtos);
}
我目前正在尝试通过API搜索查询实现TypeAhead插件。下面的代码是我从udemy类Mosh(https://github.com/mosh-hamedani/vidly-mvc-5/blob/master / ...