title: Handling a 'Many to One' Relationship in MVC 4 ASP.NET
body: <p>I have a database I created from my models and it is quite similar to the image below:
  <img src="https://i.stack.imgur.com/9Tj09.png" alt="enter image description here"> </p>
  
  <p>However, making it actually work with CRUD operations is a bit different :( </p>
  
  <p>So I took my approach on how I handled 'normal' tables and tried to make it work, but I couldn't.</p>
  
  <p>here's my DAL:</p>
  
  <pre><code>public class ArticleEntities : DbContext
  {
      public DbSet&lt;AgeGroup&gt; AgeGroups { get; set; }
      public DbSet&lt;Disabilities&gt; Disabilitiess { get; set; }
      public DbSet&lt;StrategyType&gt; StrategyTypes { get; set; }
      public DbSet&lt;Article&gt; Articles { get; set; }
      public DbSet&lt;UserProfile&gt; Profiles { get; set; }
      public DbSet&lt;DataToArticle&gt; DataToArticles { get; set; }
  
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
          modelBuilder.Conventions.Remove&lt;OneToManyCascadeDeleteConvention&gt;();
      }
  }
  </code></pre>
  
  <p><b>What I want to do</b><br></p>
  
  <p>From the website point of view, I need to access the create page (view) of the Article table
  and have drop down lists for AgeGroup, Disability, and StrategyType. With also having the ability to add more drop down lists on click (of a plus sign for example) so each category(table-Age Group, Disability, StrategyType) can have more than one value assigned to it.<img src="https://i.stack.imgur.com/67j2x.png" alt="enter image description here">  </p>
  
  <p>My models for Article, AgeGroup, Disability, StrategyType are done correctly I believe.I added this line:</p>
  
  <pre><code>public virtual List&lt;DataToArticle&gt; AgeGroupToArticle { get; set; }
  </code></pre>
  
  <p>To all of them to make them connect to the DataToArticle table. I also added this code to the DataToArticle table:</p>
  
  <pre><code>    public virtual AgeGroup AgeGroup { get; set; }
  
      public virtual Disabilities Disabilities { get; set; }
  
      public virtual StrategyType StrategyType { get; set; }
  </code></pre>
  
  <p><b>What I think needs to be done, but don't know how</b><br></p>
  
  <p>In the ArticleController I know I have to add all the additional information from the other tables into it. I have attempted to use Linq, but no avail, but I'm pretty sure it can be done this way.</p>
  
  <p>Also in the Article create view, I have to be able to access the information that has to be displayed in the drop down lists from the other tables.</p>
  
  <p>I could do all of this if I didn't have the many to one relationship table lol, it really changes everything for me.</p>