title: Data not passing from to Controller using view model
body: <p>I'm new to c# and asp.net MVC and i'm working on a small project. I'm having an error on a create view using a view model. Whats happening is that after I complete the form when I submit it the data I populated isn't being received by the controller. Below is the code for my view, for my create on the controller and a view of the ModelView i'm using </p>
  
  <pre><code> //Controllers        
  // GET: Producto/Create
  public ActionResult Create()
  {
      return View(ProductoViewModel.CargarListas());
  }
  
  
  // POST: Producto/Create
  [HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Create(ProductoViewModel producto)
  {
      Producto aux = producto.Producto;
      aux.IdRecetaPreferida = producto.IdRecetaPreferida;
      if (aux.Guardar())
      {
          return RedirectToAction(nameof(Index));
      }
      return View();
  }
  
  /*
  * My view model im using on the view
  */
  public class ProductoViewModel
  {
      public Producto Producto {get;set;}
      [Display(Name = "Receta")]
      public long IdRecetaPreferida { get; set; }
      public Receta Receta { get; set; }
      public List&lt;Receta&gt; Recetas { get; set; }
  
      public ProductoViewModel()
      {
          this.Recetas = new List&lt;Receta&gt;();
          this.Receta = new Receta();
      }
  
      public static ProductoViewModel CargarListas()
      {
          ProductoViewModel productoViewModel = new ProductoViewModel()
          {
              Recetas = Receta.TraerTodos()
          };
          return productoViewModel;
      }
  
  }
  
  //My create view
  @model WebApp.ViewModels.ProductoViewModel
  
  &lt;h2&gt;Ingresar Producto&lt;/h2&gt;
  
  &lt;hr /&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-md-12"&gt;
          &lt;form asp-action="Create"&gt;
              &lt;div asp-validation-summary="ModelOnly" class="text-danger"&gt;&lt;/div&gt;
              &lt;div class="form-group row"&gt;
                  &lt;label asp-for="Producto.Nombre" class="col-sm-2 col-form-label"&gt;&lt;/label&gt;
                  &lt;div class="col-sm-10"&gt;
                      &lt;input asp-for="Producto.Nombre" class="form-control" placeholder="Nombre Producto" /&gt;
                      &lt;span asp-validation-for="Producto.Nombre" class="text-danger"&gt;&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group row"&gt;
                  &lt;label asp-for="Producto.Descripcion" class="col-sm-2 col-form-label"&gt;&lt;/label&gt;
                  &lt;div class="col-sm-10"&gt;
                      &lt;input asp-for="Producto.Descripcion" class="form-control" placeholder="Una rica descripcion del producto" /&gt;
                      &lt;span asp-validation-for="Producto.Descripcion" class="text-danger"&gt;&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group row"&gt;
                  &lt;label asp-for="IdRecetaPreferida" class="col-sm-2 col-form-label"&gt;&lt;/label&gt;
                  &lt;div class="col-sm-10"&gt;
                      @Html.DropDownListFor(m =&gt; m.IdRecetaPreferida, new SelectList(Model.Recetas, "Id", "Nombre"), new { @class = "custom-select" })
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;input type="submit" value="Create" class="btn btn-primary" /&gt;
                  &lt;a asp-action="Index"&gt;Volver&lt;/a&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>If could point out my error would appreciate it. Below is a screenshot of the variable being debugged</p>
  
  <p><a href="https://i.stack.imgur.com/y8HEY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y8HEY.jpg" alt="Debug view of the create in the controller"></a></p>