프로필보기를 반환하는 세부 정보 페이지가 있습니다.이보기는 기본적으로 데이터베이스에서 페이지 번호를 찾는 데 사용됩니다. 또한 반환보기에 반환하고 싶은 개별 쿼리가 있지만 방법을 알 수 없습니다. 내가 가진 코드는mvc 3 다른 객체와 함께 반환보기
입니다public ActionResult detail(int id)
{
profile profile = db.profiles.Find(id);
var currentpage = (from s in db.profiles where id == s.profileID select s.registrationID).FirstOrDefault();
var articles = (from s in db.Articles where currentpage == s.RegistrationID select s.title).FirstOrDefault();
ViewBag.articles = articles;
ViewBag.noprofiler = " This profile currently doesn't have the email profiler selected";
return View(profile);
}
나는 또한 내가 viewbag에 넣어하지만 그 어떤 아이디어가 작동하지 않는 기사를 반환 하시겠습니까? 기사는 다음 채워 경우
컨트롤러에 값이 할당되어 있으면 기사를 ViewBag에 추가해야 사용할 수 있습니다. ViewBag에서 기사에 액세스하기 위해보기에서 사용한 코드에 문제가있을 수 있습니다. 이 작업을 수행하는 데 사용했던보기 코드를 통과 할 수 있습니까? –