Handling requests using controllers and actions
Controllers are the fundamental blocks for designing RESTful servicers using an ASP.NET Core web API. These are the primary classes that hold the logic to process the request, which includes retrieving data from a database, inserting a record into a database, and so on. Controllers are the classes where we define methods to process the request. These methods usually include validating the input, talking to a data store, applying business logic (in enterprise applications, controllers will also call service classes), and finally serializing the response and sending it back to the client using HTTP protocols in JSON/XML form. All these methods that hold the logic to process requests are known as Actions. All the requests received by the HTTP server are handed over to action methods using a routing engine. However, a routing engine transfers requests to Actions based on the certain rules that can be defined in a request pipeline. These rules...