Pass parameters to action method in ASP.NET Core

One of the simplest and easiest ways to pass parameters to an action method is passing it via the URL. The following code snippet illustrates how you can pass parameters in the URL.

public IActionResult GetAuthor(int authorId)
   var data = authorRepository.GetAuthor(authorId);
   return View(data);

The URL to the endpoint is:

GET: http://localhost:8061/Default/GetAuthor/1

Here are some of links;

FavoriteLoadingAdd to favorites
Spread the love

Author: Shahzad Khan

Software developer / Architect