
Building Your First Web API with ASP.NET Core Part 3: Implementing POST, PUT & DELETE
This is Part 3 of a 4-part series. In Part 2 , we built our Pizza model, an in-memory data service, and wired up two GET endpoints. Now it's time to handle the write side of our API. Where We Left Off By the end of Part 2, our PizzaController could respond to two GET requests: GET /pizza — returns all pizzas GET /pizza/{id} — returns a specific pizza or a 404 That covers the Read in CRUD. This part finishes the job with Create , Update , and Delete — using POST , PUT , and DELETE respectively. Here's the full HTTP verb-to-CRUD mapping we're working with: HTTP Verb CRUD Operation ASP.NET Core Attribute GET Read [HttpGet] POST Create [HttpPost] PUT Update [HttpPut] DELETE Delete [HttpDelete] IActionResult vs ActionResult<T> — A Quick Clarification In Part 2, our GET methods returned ActionResult<T> — a typed wrapper that tells ASP.NET Core exactly what shape the response body will have. For write operations, we'll use IActionResult instead. Why? Because write endpoints often return no bo
Continue reading on Dev.to Tutorial
Opens in a new tab




