# 1.2.1.Action

## 1.Action Result

*   reference from udemy.com \[the complete aspnet mvc 5 course

    &#x20; ![](https://github.com/jenhsuan/asp-net/tree/4be758d868ba14011a3e816f30e65a6ee7ad7252/assets/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%202017-04-01%20%E4%B8%8B%E5%8D%8810.35.09.png)

## 2.Parameters source

* 1.以下寫法都會導到MovieController.Edit(int id):
  * 1.In the url
    * movie/edit/1
  *   2.In the query string

      * movie/edit?id=1

      ```
        public ActionResult Edit(int id)
        {
            return Content("id = " + id);
        }
      ```
* 2.Pass option parameters
  * movie/index?pageindex=100
  *   movie/index?sortBy=releaseDate

      ```
      public ActionResult Index(int? pageIndex, string sortBy)
        {
            if(!pageIndex.HasValue)
            {
                pageIndex = 1;
            }

            if(String.IsNullOrWhiteSpace(sortBy))
            {
                sortBy = "Name";
            }

            return Content(String.Format("pageIndex={0}&sortBy={1}", pageIndex, sortBy));
        }
      ```
