-1

I'm little bit confused here, I will post images as easier explanation: (In image below is my Controller which has 2 action methods Index and Details, Index is used to show all employees and Details is used to show details about selected employee):

enter image description here

The code I wrote is working but I want to know why :))) I sound crazy here but whatever, here is another image where I've created Index view:

enter image description here

On the image above is shown Action link and method "Details" is being set as actionName, so I'm wondering how that "Details" know that I'm talking about Details from my EmployeeController

Thanks guys Cheers

Roxy'Pro
  • 4,216
  • 9
  • 40
  • 102
  • 1
    Please do not post code as images. We don't program using Photoshop. Post your code as text. – mason Apr 11 '17 at 18:15
  • 1
    Because your using [this overload](https://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink(v=vs.118).aspx#M:System.Web.Mvc.Html.LinkExtensions.ActionLink%28System.Web.Mvc.HtmlHelper,System.String,System.String,System.Object%29) where the controller name is the name of the **current** controller - the one that generated your `Index.cshtml` view. –  Apr 12 '17 at 04:09

1 Answers1

0

In MVC

Folder structure is

Model
  Employee.cs
Controller
  EmployeeController.cs
View
  Employee
    Index
    Details

Here in View - Employee folder name if associated with controller EmployeeController(Employee + Controller)

So every time when routing done with either of linkclick or any other actions performed it goes to the route table defined and matching controller with view folder name it executes the actions.

visit : https://www.asp.net/mvc/overview/controllers-and-routing

Hope I justify your question with simple way of understanding.

Komal
  • 304
  • 1
  • 7