title: foreach loop through different models in the view model to display links
body: <p>I have two tables called objects and apartments, which are "connected" with foreign keys called <code>apartmentID</code> and <code>ObjectID</code>. My controller and model are pretty simple:</p>
  
  <p>Model:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace Projekt.Models
  {
      public class WrapperModel
      {
  
          public IEnumerable&lt;Projekt.Models.objects&gt; Objects { get; set; }
          public IEnumerable&lt;Projekt.Models.apartments&gt; Apartments { get; set; }
  
  
      }
  }
  </code></pre>
  
  <p>And my controller is:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Data.Entity;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  using Projekt.Models;
  
  namespace Projekt.Controllers
  {
      public class WrapperController : Controller
      {
          public ActionResult Index()
          {
              WrapperModel wrapperModel = new WrapperModel();
              return View(wrapperModel);
          }
      }
  }
  </code></pre>
  
  <p>I want to make a view that will use @foreach loop to:</p>
  
  <ul>
  <li><p>take a name of each Object, and link the name to its <code>Details.cshtml</code> page</p></li>
  <li><p>display Id of the apartment linking to its <code>Details.cshtml</code> page next to the Object link.</p></li>
  </ul>