ASP.NET Core Web API CRUD methods example

Download our ASP.NET Core Web API example which includes an endpoint for each of the CRUD methods.

Each of the methods uses a different HTTP method depending on the CRUD method used as well as a different HTTP response. These are:

CRUD method HTTP method HTTP response
Create HTTP POST 201 Created
Read HTTP GET 200 OK
Update HTTP PUT 204 No Content
Delete HTTP DELETE 204 No Content

These have been set up so it can be tested in both Swagger and Postman.

Software

This is the software that will need to be installed onto your machine.

Get the application working

These are the steps to get the application working.

  • Fill out the code example form. We will send you an email where you can download the code example.

You are now ready to go.

Open the project in Visual Studio

Open up RoundTheCode.WebApi.sln in Visual Studio 2022.

C# coding challenges

C# coding challenges

Our online code editor allows you to compile the answer.

Start the project in Visual Studio. It will load up https://localhost:7080/swagger/index.html.

Test each of the endpoints set up and see what HTTP response is returned.

To test in Postman, make sure that the Web API is running and then use the endpoints in Swagger to test each one.

More information

Watch our video where we add each API endpoint to the controller and test in Postman.

As well as that, read our tutorial where we explain how to create an ASP.NET Core Web API and how to set up each of the endpoints.