--- uid: mvc/overview/older-versions/getting-started-with-aspnet-mvc4/examining-the-edit-methods-and-edit-view title: "Examining the Edit Methods and Edit View | Microsoft Docs" author: Rick-Anderson description: "Note: An updated version of this tutorial is available here that uses ASP.NET MVC 5 and Visual Studio 2013. It's more secure, much simpler to follow and demo..." ms.author: aspnetcontent manager: wpickett ms.date: 08/28/2012 ms.topic: article ms.assetid: 41eb99ca-e88f-4720-ae6d-49a958da8116 ms.technology: dotnet-mvc ms.prod: .net-framework msc.legacyurl: /mvc/overview/older-versions/getting-started-with-aspnet-mvc4/examining-the-edit-methods-and-edit-view msc.type: authoredcontent --- Examining the Edit Methods and Edit View ==================== by [Rick Anderson](https://github.com/Rick-Anderson) > > [!NOTE] > > An updated version of this tutorial is available [here](../../getting-started/introduction/getting-started.md) that uses ASP.NET MVC 5 and Visual Studio 2013. It's more secure, much simpler to follow and demonstrates more features. In this section, you'll examine the generated action methods and views for the movie controller. Then you'll add a custom search page. Run the application and browse to the `Movies` controller by appending */Movies* to the URL in the address bar of your browser. Hold the mouse pointer over an **Edit** link to see the URL that it links to. ![EditLink_sm](examining-the-edit-methods-and-edit-view/_static/image1.png) The **Edit** link was generated by the `Html.ActionLink` method in the *Views\Movies\Index.cshtml* view: [!code-cshtml[Main](examining-the-edit-methods-and-edit-view/samples/sample1.cshtml)] ![Html.ActionLink](examining-the-edit-methods-and-edit-view/_static/image2.png) The `Html` object is a helper that's exposed using a property on the [System.Web.Mvc.WebViewPage](https://msdn.microsoft.com/library/gg402107(VS.98).aspx) base class. The `ActionLink` method of the helper makes it easy to dynamically generate HTML hyperlinks that link to action methods on controllers. The first argument to the `ActionLink` method is the link text to render (for example, `Edit Me`). The second argument is the name of the action method to invoke. The final argument is an [anonymous object](https://weblogs.asp.net/scottgu/archive/2007/05/15/new-orcas-language-feature-anonymous-types.aspx) that generates the route data (in this case, the ID of 4). The generated link shown in the previous image is `http://localhost:xxxxx/Movies/Edit/4`. The default route (established in *App\_Start\RouteConfig.cs*) takes the URL pattern `{controller}/{action}/{id}`. Therefore, ASP.NET translates `http://localhost:xxxxx/Movies/Edit/4` into a request to the `Edit` action method of the `Movies` controller with the parameter `ID` equal to 4. Examine the following code from the *App\_Start\RouteConfig.cs* file. [!code-csharp[Main](examining-the-edit-methods-and-edit-view/samples/sample2.cs)] You can also pass action method parameters using a query string. For example, the URL `http://localhost:xxxxx/Movies/Edit?ID=4` also passes the parameter `ID` of 4 to the `Edit` action method of the `Movies` controller. ![EditQueryString](examining-the-edit-methods-and-edit-view/_static/image3.png) Open the `Movies` controller. The two `Edit` action methods are shown below. [!code-csharp[Main](examining-the-edit-methods-and-edit-view/samples/sample3.cs)] Notice the second `Edit` action method is preceded by the `HttpPost` attribute. This attribute specifies that that overload of the `Edit` method can be invoked only for POST requests. You could apply the `HttpGet` attribute to the first edit method, but that's not necessary because it's the default. (We'll refer to action methods that are implicitly assigned the `HttpGet` attribute as `HttpGet` methods.) The `HttpGet` `Edit` method takes the movie ID parameter, looks up the movie using the Entity Framework `Find` method, and returns the selected movie to the Edit view. The ID parameter specifies a [default value](https://msdn.microsoft.com/library/dd264739.aspx) of zero if the `Edit` method is called without a parameter. If a movie cannot be found, [HttpNotFound](https://msdn.microsoft.com/library/gg453938(VS.98).aspx) is returned. When the scaffolding system created the Edit view, it examined the `Movie` class and created code to render `