title: Beginform doesn't send viewmodel and doesn't reach my httppost method
body: <p>I have a strange situation. I use the <code>BeginForm</code> helper in ASP.NET MVC. Normally, if you use a viewmodel on a view, then it will post to the viewmodel to my controller.</p>
  
  <p>Right now it will hit my HTTPGET method, which has no parameters. My best guess is the viewmodel isn't being sent back to the server.</p>
  
  <p>I have attached my view, controller and viewmodel code below.</p>
  
  <p>How do I make sure my HttpPost method is being hit, when submitting the form? Am I doing something obvious wrong?</p>
  
  <p><strong>My view</strong>:</p>
  
  <pre><code>@using LetterAmazer.Websites.Client.Extensions
  
  @model LetterAmazer.Websites.Client.ViewModels.CreditsViewModel
  
  &lt;h1&gt;Buy credits&lt;/h1&gt;
  
  You currently have @Model.Credit.ToFriendlyMoney() credits.
  
  
  &lt;h3&gt;How many credits do you want to purchase?&lt;/h3&gt;
  @using (Html.BeginForm("Credits", "User", FormMethod.Post))
  {
  
      @Html.EditorFor(model =&gt; model.PurchaseAmount) &lt;text&gt;($)&lt;/text&gt;
  
      &lt;h3&gt;Select payment method&lt;/h3&gt;
      @Html.DropDownListFor(model =&gt; model.SelectedPaymentMethod, Model.PaymentMethods, new { @class = "form-control" })
  
      &lt;input type="submit" class="btn btn-primary btn-lg" value="Purchase credits" /&gt;
  
  }
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $('#@Html.IdFor(model=&gt;model.PurchaseAmount)').change(function () {
              var value = $('#@Html.IdFor(model =&gt; model.PurchaseAmount)').val();
              if (value &lt;= 1) {
                  $('#@Html.IdFor(model=&gt;model.PurchaseAmount)').val('1');
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>My controller:</strong></p>
  
  <pre><code> [HttpGet]
          public ActionResult Credits()
          {
              CreditsViewModel model = new CreditsViewModel();
              model.Credit = SessionHelper.Customer.Credit;
              model.CreditLimit = SessionHelper.Customer.CreditLimit;
  
              var possiblePaymentMethods =
                  paymentService.GetPaymentMethodsBySpecification(new PaymentMethodSpecification()
                  {
                      CustomerId = SessionHelper.Customer.Id
                  });
              foreach (var possiblePaymentMethod in possiblePaymentMethods)
              {
                  model.PaymentMethods.Add(new SelectListItem()
                  {
                      Text = possiblePaymentMethod.Name,
                      Value = possiblePaymentMethod.Id.ToString()
                  });
              }
  
  
              return View(model);
          }
  
          [HttpPost]
          public ActionResult Credits(CreditsViewModel model)
          {
              // stufff
          }
  </code></pre>
  
  <p><strong>My viewmodel:</strong></p>
  
  <pre><code> public class CreditsViewModel
      {
          public List&lt;SelectListItem&gt; PaymentMethods { get; set; }
          public string SelectedPaymentMethod { get; set; }
  
          public int PurchaseAmount { get; set; }
  
          public decimal Credit { get; set; }
          public decimal CreditLimit { get; set; }
  
          public CreditsViewModel()
          {
              this.PaymentMethods = new List&lt;SelectListItem&gt;();
              this.PurchaseAmount = 50;
          }
      }
  </code></pre>