title: ViewBag multiple SelectList for dropdown list
body: <p>I am trying to use dropdownList with two foreign keys which are modelId, and categoryId.
  And I am using ViewBag with selectList.</p>
  
  <pre><code>public ActionResult Create()
      {
          ViewBag.categoryId = new SelectList(db.Category, "categoryId", "name");
          ViewBag.modelId = new SelectList(db.Model, "modelId", "name");
          return View();
      } 
  
      //
      // POST: /Product/Create
  
      [HttpPost]
      public ActionResult Create(Product product)
      {
          if (ModelState.IsValid)
          {
              db.Product.Add(product);
              db.SaveChanges();
              return RedirectToAction("Index");  
          }
          ViewBag.categoryId = new SelectList(db.Category, "categoryId", "name", product.categoryId);
          ViewBag.modelId = new SelectList(db.Model, "modelId", "name", product.modelId);
          return View(product);
      }
  </code></pre>
  
  <p>And here is my Create.cshtml.</p>
  
  <pre><code>&lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Category)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.DropDownList("categoryId", "--Select--")
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Model)
      &lt;/div&gt;
  
      &lt;div class="editor-field"&gt;
          @Html.DropDownList("modelId", "--Select--")
      &lt;/div&gt;
  </code></pre>
  
  <p>When I press submit button, error come up, 
  'An item with the same key has already been added'
  What is problem? Is it problem with in Model?</p>
  
  <p>Here is my models.</p>
  
  <pre><code>--Prodruct.cs--
  
  public class Product
  {
      [Key] public int productId { get; set; }
  
      [Required(ErrorMessage = "Please select category")]
      public int categoryId { get; set; }
  
      [Required(ErrorMessage = "Please select model")]
      public int modelId { get; set; }
  
      [DisplayName("Model name")]
      public String model { get; set; }
  
      public virtual Category Category { get; set; }
      public virtual Model Model { get; set; }
  }
  
  --Category.cs--
  public class Category
  {
      [Key] public int categoryId { get; set; }
      public String name { get; set; }
  }
  
  --Model.cs--
  public class Model
  {
      [Key] public int modelId { get; set; }
      public String name { get; set; }
  }
  
  --RentalDB.cs--
  public class rentalDB : DbContext
  {
      public DbSet&lt;Product&gt; Product { get; set; }
      public DbSet&lt;Model&gt; Model { get; set; }
      public DbSet&lt;Customer&gt; Customer { get; set; }
      public DbSet&lt;Order&gt; Order { get; set; }
      public DbSet&lt;Cart&gt; Cart { get; set; }
      public DbSet&lt;Category&gt; Category { get; set; }
      public DbSet&lt;OrderDetails&gt; OrderDetails { get; set; }
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
      }
  }
  </code></pre>
  
  <p>Where it is wrong? Index page in Create can get category data and model data. However, when I submit it, it has error, 'An item with the same key has already been added'.
  Could you help me where has got problem?
  Thank you.</p>
  
  <p>--added more coding--</p>
  
  <p>I am using this LINQ. Probably here has problem. </p>
  
  <p>How can I add 'Model' entity in here?</p>
  
  <pre><code>var product = from a in db.Product.Include(a =&gt; a.Category)
                        select a;
  </code></pre>