title: How to pass data between controller and view in .Net MVC?
body: <p>What I want is that when the schedule form is loaded for the first time (or without data passing), it shows a list of MovieName. When I click on one MovieName, its ID is sent back to controller as an input of a SQL query, then the result is passed back to the view.</p>
  
  <p>Here are what I've done. But I think when I click on the ActionLink, the controller doesnt handle the data passed back as it is not HttpPost. Also, I dont know how to show the new data back in view. Please help!</p>
  
  <p>ScheduleController.cs</p>
  
  <pre><code>[HttpGet]
  public ActionResult Index()
      {          
          var schedules = db.Schedules.Include(s =&gt; s.Movie)
                  .OrderByDescending(s =&gt; s.Movie.MovieName)
                  .ToList();
          return View(schedules);
      }
  
  [HttpPost]
  public ActionResult Index(int MovieID)
      {
          //return ("Clicked");
          var schedules = (from s in db.Schedules
                           orderby s.ShowDate
                           select s).ToList();
          return View(schedules);
      }
  </code></pre>
  
  <p>Schedule/Index</p>
  
  <pre><code>@using Booking_Ticket_Management_System.Models;
  @model IEnumerable&lt;Schedule&gt;
  
  @{
     ViewBag.Title = "Schedule";
  }
  &lt;h2&gt;Choose movies&lt;/h2&gt;
  @using (Html.BeginForm())
  {
  &lt;div&gt;
          @foreach (Schedule schedule in @Model)
          {
  
                  @Html.ActionLink(schedule.Movie.MovieName, "Index", "Schedule", new { MovieID = schedule.MovieID},null)
  
              &lt;br /&gt;
          }
      &lt;br /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>}</p>