title: How to get Database items into a list with ASP MVC
body: <p>I cant seem to get the URL's in a simple list which I can show on a page. I already have the connection with the database in another project within my solution and that works for sure. only problem is putting the data into a list. </p>
  
  <p>URLController</p>
  
  <pre><code>public class URLController : Controller
  {      
      public ActionResult List()
      {
          LinkHubDbEntities db = new LinkHubDbEntities();
          ViewBag.UrlList = new SelectList(db.tbl_Url.OrderBy(c =&gt; c.UrlId), "UrlTitle", "UrlDesc");
  
          return View();
      }
  }
  </code></pre>
  
  <p>The view : </p>
  
  <pre><code>@model BOL.tbl_Url
  
  @{
  ViewBag.Title = "List";
  }
  
  &lt;ul&gt;
  
  @foreach (var UrlId in ViewBag.UrlList)
  {
      &lt;li&gt;@tbl_Url.UrlTitle&lt;/li&gt;
  }
  
  &lt;/ul&gt;
  </code></pre>