Book Image

ASP.NET Core Essentials

By : Shahed Chowdhuri
Book Image

ASP.NET Core Essentials

By: Shahed Chowdhuri

Overview of this book

<p>ASP.NET Core is the latest collection of Microsoft’s web application development technologies. When you’re trying to reach a broad spectrum of users with a robust web application, ASP.NET Core is there to help you build that application. With the ability to cater to users on desktop, tablet, or smartphone platforms, you can put together a solution that works well anywhere.</p> <p>This book is what you need to get started developing ASP.NET Core applications was quickly as possible; starting by introducing the software and how it can be used in today’s modern world of web applications and smartphone apps. Walking you through the benefits of a Web API to support both applications and mobile apps to give you a solid understanding of the tech to build upon as you see what ASP.NET Core can do for you.</p> <p>The book wraps up with practical guidelines for the use of database technologies, unit tests, security best practices, and cloud deployments for the real world.</p>
Table of Contents (15 chapters)
ASP.NET Core Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Building controllers


Your MVC controller is where the magic happens. Requests come in from the end-user, then content and data get returned. What happens in between is up to you-the developer.

Controller methods

By default, controller methods can be used for HTTP GET requests using the [HttpGet] attribute or omitting this action verb attribute altogether, as it is the default behavior. Most likely, you have already been using the following HTTP GET and POST verbs:

  • HttpGet: Uses the HTTP GET method with optional querystring parameters

  • HttpPut: Uses the HTTP POST method for form submissions to create an entity

In addition to the preceding, you should also be aware of additional HTTP verbs that can be used as controller attributes; they are as follows:

  • HttpPut: Uses the HTTP PUT method to edit an existing entity

  • HttpDelete: Uses the HTTP DELETE method to delete an existing entity

  • HttpPatch: Allows partial model updates instead of a full PUT request

  • AcceptVerbs: Allows multiple action verbs to...