title: Populate DropDownList from model/database in MVC 5
body: <p>I have been searching around for almost 3 days to find a solution to the following problem.
  I'm simply trying to add a <code>DropDownList</code> in <code>RegisterViewModel (Identity)</code>.
  During user registration I need to prompt for the <code>Gender</code>.</p>
  
  <p>I have already inserted the following items in the table.</p>
  
  <pre><code>Code = F
  Definition = Female
  -------------------
  Code = M
  Definition = Male
  </code></pre>
  
  <p>When I generate the DropDownList directly inside GenderDDController and it's view it works perfectly but as soon as I'm in <code>RegisterViewModel</code> I have zero chance due to I can't reference multiple models in <code>Register.cshtml (View)</code>.</p>
  
  <p>I should also indicate that I'm new to MVC and I'm sure that's the only reason that I look confused right now.</p>
  
  <h2>GenderDD | Model</h2>
  
  <pre><code>public partial class GenderDD
  {
      public int Id { get; set; }
  
      [StringLength(1)]
      public string Code { get; set; }
  
      [StringLength(50)]
      public string Definition { get; set; }
  
      public DateTime? CreateDate { get; set; }
  
      [StringLength(50)]
      public string CreatedBy { get; set; }
  
      public bool Deleted { get; set; }
  
      public DateTime? UpdateDate { get; set; }
  
      [StringLength(50)]
      public string UpdatedBy { get; set; }
  }
  </code></pre>
  
  <h2>RegisterViewModel | Controller</h2>
  
  <pre><code>[AllowAnonymous]
  public ActionResult Register()
  {
     ViewData["GenderList"] =
     Enum.GetValues(typeof (GenderDD))
       .Cast&lt;GenderDD&gt;()
       .Select(c =&gt; new SelectListItem {Text = c.ToString(), Value = c.ToString()});
  
     return View();
  }
  </code></pre>