title: Sitecore Load all items into an MVC model?
body: <p>I have created a bunch of custom templates to store items (such as <code>Industries</code>, <code>Subindustries</code>, etc.) in Sitecore. I now want to go about loading these into my Sitecore MVC model.</p>
  
  <hr>
  
  <p>The lists are located in <em>sitecore > Content > Lists</em>.   For example inside the <em>Lists</em> folder there is a folder called <em>Country</em>.   I want to get back all the items <strong>within</strong> the <em>Country</em> folder and populate them as unordered list in my view.</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong> I implemented the <em>Glass.Mapper.Sc</em> method suggested below.   It is fully operational now.</p>
  
  <p>This is what my working model looks like now:</p>
  
  <pre class="lang-cs prettyprint-override"><code>using Glass.Mapper.Sc.Configuration;
  using Glass.Mapper.Sc.Configuration.Attributes;
  using Sitecore.Data.Items;
  using Sitecore.Mvc.Presentation;
  using System;
  using System.Collections.Generic;
  
  namespace Sitecore.Web.Models
  {
      public class Registration: IRenderingModel
      {
          public Rendering Rendering { get; set; }
          public Item Item { get; set; }
          public Item PageItem { get; set; }
  
          public IEnumerable&lt;CountryChildItem&gt; CountryList { get; set; }
  
          [SitecoreType(AutoMap = true)]
          public class CountryItem
          {
              public virtual IEnumerable&lt;CountryChildItem&gt; Children { get; set; }
          }
  
          [SitecoreType(AutoMap = true)]
          public class CountryChildItem
          {
              [SitecoreId]
              public virtual Guid Id { get; set; }
  
              [SitecoreInfo(SitecoreInfoType.Path)]
              public virtual string Path { get; set; }
  
              [SitecoreField]
              public virtual string DisplayName { get; set; }
  
              [SitecoreField]
              public virtual string Abbreviation { get; set; }
          }
  
          public void Initialize(Rendering rendering)
          {
              Rendering = rendering;
              Item = rendering.Item;
              PageItem = PageContext.Current.Item;
          }
      }
  }
  </code></pre>
  
  <p>and this is what my working contoller looks like:</p>
  
  <pre class="lang-cs prettyprint-override"><code>using Glass.Mapper.Sc;
  using Sitecore.Web.Models;
  using System.Web.Mvc;
  
  namespace Sitecore.Web.Controllers
  {
      public class RegistrationController : Controller
      {
          Registration registrationModel = new Registration();
  
          public ActionResult Index()
          {
              ISitecoreContext sitecoreContext = new SitecoreContext();
              ISitecoreService service = new SitecoreService(sitecoreContext.Database);
              Registration.CountryItem countryItem = service.GetItem&lt;Registration.CountryItem&gt;("/sitecore/content/Lists/Country");
              registrationModel.CountryList = countryItem.Children;
              return View(registrationModel);
          }
      }
  }
  </code></pre>
  
  <p>and a snippet of my working view:
  </p>
  
  <pre><code> &lt;ul class="select-menu-options dropdown-menu"&gt;
      @foreach (var country in Model.CountryList)
      {
          &lt;li&gt;&lt;a href="#"&gt;@country.DisplayName&lt;/a&gt;&lt;/li&gt;
      }
   &lt;/ul&gt;
  </code></pre>