Linq转换为SQL查询获取值where where context.purposes.tolist
(id = 4000到4050)它是怎么回事?
public ActionResult Index()
{
PurposeModel model = new PurposeModel();
using (DAL.db_Hajj_UmrahEntities context = new DAL.db_Hajj_UmrahEntities())
{
List<DAL.Purpose> purposelist = context.Purposes.ToList();
model.PurposeList = purposelist.Select(x => new SelectListItem()
{
Text =x.PurPose1,
Value=x.Id.ToString()
});
}
return View(model);
}
答案 0 :(得分:2)
我认为这就是你要找的东西
context.Purposes.where(s=>s.id>=4000 && s.id<=4050).ToList();
答案 1 :(得分:0)
{{1}}