title: C# MVC Post form not passing ID from view to controller
body: <p>I am new to MVC. I work on an auction application. On the auction site, there should be a form for making a bid. I have a problem passing the auction parameter to the controller</p>
  
  <p>My models: </p>
  
  <pre><code>public class Auctions
  {
      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int ID { get; set; }
      public string title { get; set; }
      (..) some other fields
      public List&lt;Bid&gt; bids = new List&lt;Bid&gt;(); 
  }
  
  public class BiddingViewModel
  {
      public Auctions auctionToSend { get; set; }
      public double bid { get; set; }
  }
  </code></pre>
  
  <p>My view: </p>
  
  <pre><code>@model BiddingViewModel
  
  @using(Html.BeginForm("CreateBid", "Auction", FormMethod.Post, new { enctype = "multipart/form-data" }))
  {
      @Html.HiddenFor(model=&gt;model.auctionToSend)
      @Html.EditorFor(model =&gt; model.bid)
      &lt;input type="submit" value="Make it work" /&gt;
  
  }
  </code></pre>
  
  <p>and my controller: </p>
  
  <pre><code>[AllowAnonymous]
  public ActionResult AuctionPage(int id)
  {
      var tmp = _context.Auctions.FirstOrDefault(i =&gt; i.ID == id);
  
      BiddingViewModel bvm = new BiddingViewModel
      {
          auctionToSend = tmp,
          bid = -1
      };
  
      return View(bvm);
  }
  
  
  [Authorize]
  [HttpPost]
  public async Task&lt;ActionResult&gt; CreateBid(BiddingViewModel bvm)
  {
      //After filling the form from view, the bvm.auctionToSend is null, whereas the bvm.bid value is visible
      return RedirectToAction("AuctionList", "Auction");
  }
  </code></pre>
  
  <p>My problem is that the auction data (perfectly visible in the view) is not sent back to the controller. I checked the internet and it showed me some naming-conflicts' solutions, so I made sure the naming is different, but this didn't fix my problem. </p>