【发布时间】:2015-08-02 08:41:12
【问题描述】:
我正在学习 Asp.Net MVC。我在处理下拉列表时遇到了一个小问题。
我不想列出具有管理员角色的用户
public ActionResult Create()
{
var user = db.Users.Where(u => u.Roles.Where(r => r.RoleId != "1"));
ViewBag.UserId = new SelectList(user, "Id", "UserName");
return View();
}
我收到此错误
错误 2 无法将 lambda 表达式转换为委托类型“System.Func”,因为块中的某些返回类型不能隐式转换为委托返回类型
错误 1 无法将类型“System.Collections.Generic.IEnumerable”隐式转换为“bool”
【问题讨论】: