public DoctorClass GetById(int id)
{
using (var context = new EmrContext())
{
var query = from d in context.Doctors
join c in context.Users on d.Id equals c.Id
where d.Id==id
select new DoctorClass { Email = c.Email, FirstName = c.FirstName, LastName = c.LastName, Post = d.Post };
return query;
}
}
这是错误:无法将类型“System.Linq.IQueryable”隐式转换为“Mvc.Models.DoctorClass”。存在显式转换(您是否缺少演员表?)
我需要用“查询”做什么来解决这个问题?