.NET Core 2.0, Angular 4 and MySQL
- In the previous post, we created a request with some code refactoring actions.
- This post is divided into several sections: – – Firstly, let’s modify the decoration attribute for the action method in the controller: – – With this modification, we are setting the name for the action.
- If you wanted to, you could explicitly mark the action to take this parameter from the URI by decorating it with attribute, though I wouldn’t recommend that at all due to the security reasons and complexity of the request.
- Create another extension method like this: – – Now let’s just change the code in the controller from the: – – in the and actions.
- First, in the project inside the Extensions folder, we are going to create the class with the following code: – – And then, change the : – – As you may have noticed, the method is decorated with the attribute.
How to create POST, PUT and DELETE requests; Author: Code Maze; Updated: 19 Feb 2018; Section: ASP.NET; Chapter: Web Development; Updated: 19 Feb 2018
@codeproject: .NET Core 2.0, Angular 4 and MySQL – Part 6 – POST, PUT, and DELETE by Code Maze
Please Sign up or sign in to vote.
In the previous post, we created a request with some code refactoring actions. In this post, we are going to create , and requests and by doing so, we are going to complete the server part (.NET Core part) of this series.
Let’s get into it.
If you want to see all the basic instructions and complete navigation for this series, please follow the link: Introduction page for this tutorial.
For the previous part, check out: Part 5 – Creating .NET Core WebApi project – Using repository for the GET requests.
The source code is available for download at .NET Core, Angular 4 and MySQL. Part 6 – Source Code.
This post is divided into several sections:
Firstly, let’s modify the decoration attribute for the action method in the controller:
With this modification, we are setting the name for the action. This name will come in handy in the action method for creating a new owner.
After the modification, we are going to implement that :
Right now is a good time to test this code by sending the request by using Postman.
Let’s examine the result…