Before reading this article, I would recommend reading the following previous part.
Introduction
In this article we will see a simple Web API project with HTTP methods like GET, POST, PUT and DELETE.
- GET - Used to read from the list.
- POST - Used to add in the list.
- PUT - Used to modify/ update the element in the list.
- DELETE - Used to delete the element from the list.
Now let’s see step by step implementation of all methods:
- Open Visual Studio Editor.
- Select ‘FILE’ menu, expand ‘New’ and click on ‘Project…’

- Expand ‘Visual C#’ and select ‘Web’ from the left panel.?
- Select ‘ASP.NET Web Application’.
- Provide appropriate name of the application and select the location.
- Click on ‘OK’ button.

- Select ‘Empty’ as a template and check ‘Web API’ checkbox.
- Press ‘OK’ button and it will create an empty Web API project.

- Right click on ‘Controllers’, expand ‘Add’ and click on ‘Controller…’

- Select ‘Web API 2 Controller with read/write actions’ and press ‘Add’ button, which will add all HTTP methods.

- Provide appropriate name and press ‘Add’ button.

- Controller is created with read/write actions,

- Now let’s create List of string and do CRUD operations on it.
- GET – Returns entire list
- GET with ID – Returns value associated with the ID
- POST – Adds one value in the list
- PUT – Updates existing value
- DELETE – Deletes existing value












Anil Kumar PradhanPosted Jul 8, 2016, 2:39 AM
Easy to understand with clear steps
Sonu ChaudharyPosted May 10, 2016, 7:35 AM
good one
Rohit PrakashPosted May 10, 2016, 6:04 AM
useful points
Munesh SharmaPosted May 9, 2016, 12:34 PM
good
Vignesh ManiPosted May 2, 2016, 12:01 PM
nice one
Vignesh ManiPosted May 2, 2016, 11:58 AM
Nice one
Debasis SahaPosted May 2, 2016, 10:08 AM
Nice One..
Mohammed IbrahimPosted May 2, 2016, 8:10 AM
nice
Sonu ChaudharyPosted May 2, 2016, 5:51 AM
nice one ..
Gowtham RajamanickamPosted May 2, 2016, 5:05 AM
good one..
Bhavik PatelPosted May 2, 2016, 4:44 AM
nice