title: How does @Html.BeginForm() works?
body: <p>I'm very new to ASP.NET, just started the MVC tutorial today on asp.net. I got here <a href="http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-edit-methods-and-edit-view">http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-edit-methods-and-edit-view</a></p>
  
  <p>So far so good, the problem:</p>
  
  <p>In my View I have the following code
  (Model is set to the view with @model MyFirstMVC4.Models.Movie)</p>
  
  <pre><code>@using (Html.BeginForm()) {
      @Html.ValidationSummary(true)
  
      &lt;fieldset&gt;
          &lt;legend&gt;Movie&lt;/legend&gt;
  
          @Html.HiddenFor(model =&gt; model.ID)
  
          //... bla bla html input
          &lt;p&gt;
               &lt;input type="submit" value="Save" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  }
  </code></pre>
  
  <p>My MovieController </p>
  
  <pre><code>    // Shows the view
      public ActionResult Edit(int id = 0)
      {
          Movie movie = db.Movies.Find(id);
          if (movie == null)
          {
              return HttpNotFound();
          }
          return View(movie);
      }
  
      //
      // POST: /Movie/Edit/5
  
      [HttpPost] // Handles the view above
      public ActionResult Edit(Movie movie)
      {
          if (ModelState.IsValid)
          {
              db.Entry(movie).State = EntityState.Modified;
              db.SaveChanges();
              return RedirectToAction("Index");
          }
          return View(movie);
      }
  </code></pre>
  
  <p>And here is the question - How the heck does it pass the Movie object to the POST method above?! When I observe the client side there is</p>
  
  <pre><code>&lt;form action = "/Movie/Edit/1" ... /&gt;
  </code></pre>
  
  <p>Here I don't understand why action = url of the very same view page?!1
  Also on the server side there is just Html.BeginForm() :(
  How does it realize to what action method to post and what route parameters to pass?
  It works, I just don't know why</p>