title: Pass IEnumerable variable to view in ASP .NET MVC
body: <p>I speak a little English. I try to ask my question.</p>
  
  <p>I have a model. it's name Product.cs</p>
  
  <pre><code>  Product
    {
      public int TypeId { get; set; }/*these are at the same time field of Type Table*/
      public string TypeName { get; set; }
  
      public int TradeMarkId { get; set; }/*at the same time field of TradeMark Table*/
      public string TradeMarkName { get; set; }
  
      public int ProductId { get; set; }/*at the same time field of TProduct Table*/
      public string ProductName { get; set; }
      public int TId { get; set; }
      public int TMId { get; set; }
  
      public List&lt;TypeProduct&gt; typeList { get; set; }
    }
  </code></pre>
  
  <p>My controller page</p>
  
  <pre><code>  My controller 
    [HttpGet]
    public ActionResult TradeMarkProduckAdd()
    {
      Product product = new Product();
      TypeList typeList = new TypeList();
      product = typeList.TypeListOf(product);
      return View(product);//"This doesn't work"            
    }
  </code></pre>
  
  <p>it says a type error
  The model item passed into the dictionary is of type 'TypeMark.Models.Product', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[TypeMark.Models.Product]'. </p>
  
  <p>when I got this error I changed the <strong>return View(product);</strong> to 
  <strong>return View((IEnumerable)product);</strong> but it didnt work again.</p>
  
  <p>view page</p>
  
  <pre><code>    @using TypeTradeMark.Models
      @model IEnumerable&lt;Product&gt;
      @using (Html.BeginForm("AddProduct", "Home", FormMethod.Post))
      {
        @foreach(var item in Model as List&lt;Product&gt;)
        {                              
          @item.ProductName
          @item.??//checkbox for every record      
          @item.??//dropdownlist for trademarks      
        }    
      }
  </code></pre>
  
  <p>TypeList class</p>
  
  <pre><code>    TypeList class
  
      public class TypeList
      {
        VtDataContext Vt = new VtDataContext();
        public Product TypeListOf(Product typeListOf)
        {          
          var query = (from c in Vt.Types select c);
          typeListOf.typeList=new List&lt;Type&gt;(query.ToList());
          return typeListof;
        }
      }
  </code></pre>
  
  <p>my tables</p>
  
  <pre><code>    Type : TypeId, TypeName
      TradeMark : TradeMarkId,TradeMarkName
      TProduct : ProductId,ProductName,TId,TMId//TId relation with TypeId, TMId relation with TradeMarkId
  </code></pre>
  
  <p>I couldnt solve the problem Can you help me? Thanks </p>