에 익명의 유형을 통과, 난 그냥 u.Name 및 s.Idoffice보기 전송하려면이 컨트롤러와 다음 컨트롤러나는 문제가 내 ASP.NET MVC보기
namespace RolesMVC3.Areas.Administrador.Controllers
{
[Authorize(Roles = "Adminr")]
public class HomeController : Controller
{
private BASEDATOSCJ_2Entities db = new BASEDATOSCJ_2Entities();
public ActionResult Index()
{
string username = User.Identity.Name;
MembershipUser user = Membership.GetUser(username);
Guid key = (Guid)Membership.GetUser().ProviderUserKey;
var Universities = (from u in db.UNIVERSITy
join s in db.CAMPUS_UNIVERSITy on u.IdUniversity equals s.IdUniversity
join c in db.CIUDAD_CAMPUS on s.IdCiudadSede equals c.IdCiudadSede
join co in db.OFFICE on s.Idoffice equals co.Idoffice
join uxc in db.USERxOFFICE on co.Idoffice equals uxc.Idoffice
where uxc.UserId == key
select new { u.Name, namecity = c.Nombre, s.Idoffice}).ToList();
return View(Universities);
}
있습니다. 내가 어떻게하는지? (사실이 컨트롤렛이 괜찮 으면 실제로 모르겠다.) 필드를 다른 테이블에 속하게하고 싶다. 쿼리를리스트로 보내고 View, ViewBag에 표시하고 싶습니까?,이 데이터를 뷰에 전달하고 foreach를 사용하여 표시하는 방법은 무엇입니까?
select new { u.Name, namecity = c.Nombre, s.Idoffice}
이 목록 만에 두 필드를 선택
select new { Name = u.Name, Idoffice = s.Idoffice }
사람 : 당신이 다음 줄을 변경하는 경우
나는 면도칼을
http : // stackoverflow.COM/질문/5120317/동적 익명 형 -에 - 면도칼 - 원인 - runtimebinderexception –