title: Displaying multiple tables from model in single view
body: <p>I have two tables <code>TxtComment</code> and <code>Login</code>.</p>
  
  <p>I am displaying image urls from <code>Login</code> table and comments from <code>TxtComment</code> table where username in <code>TxtComment</code> equals username in <code>Login</code>.</p>
  
  <p>I am using Db First approach using entityframework.</p>
  
  <p>How can I concatenate these columns from different tables to one common view? I used ViewBag. I got a result.</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public ActionResult Item(int id)
  {  
      FoodContext db = new FoodContext();
  
      ViewBag.FoodItems = db.FoodItems.Where(row =&gt; row.itemid == id);
  
      ViewBag.TxtComments = (from user in db.TxtComments
                             from ff in db.Logins
                             where ff.username == user.username
                             select new { imgurl = ff.imgurl, txtcmt = user.txtcmt });
  
      return View();
  
  }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>@for(var item in ViewBag.TxtComments)
  {
      &lt;div&gt;@item&lt;/div&gt;
  }
  </code></pre>
  
  <p>The result is <code>{imgurl=http:/sdfsdf,txtcmt=sfsdfsdf}</code></p>
  
  <p>I need each item seperate. How can I? I tried with <code>@item.imgurl</code>, it says error. Is view bag is better? If not, please help me this need with strongly type view.</p>