Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
ASP.NET Core 9 Web API Cookbook

You're reading from   ASP.NET Core 9 Web API Cookbook Over 60 hands-on recipes for building and securing enterprise web APIs with REST, GraphQL, and more

Arrow left icon
Product type Paperback
Published in Apr 2025
Publisher Packt
ISBN-13 9781835880340
Length 344 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Garry Cabera Garry Cabera
Author Profile Icon Garry Cabera
Garry Cabera
Luke Avedon Luke Avedon
Author Profile Icon Luke Avedon
Luke Avedon
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Chapter 1: Practical Data Access in ASP.NET Core Web APIs 2. Chapter 2: Mastering Resource Creation and Validation FREE CHAPTER 3. Chapter 3: Securing Your Web API 4. Chapter 4: Creating Custom Middleware 5. Chapter 5: Creating Comprehensive Logging Solutions 6. Chapter 6: Real-Time Communication with SignalR 7. Chapter 7: Building Robust API Tests: a Guide to Unit and Integration Testing 8. Chapter 8: GraphQL: Designing Flexible and Efficient APIs 9. Chapter 9: Deploying and Managing Your WebAPI in the Cloud 10. Chapter 10: The Craft of Caching 11. Chapter 11: Beyond the Core 12. Index 13. Other Books You May Enjoy

Updating resources with PUT and AutoMapper

This recipe will demonstrate how to update an existing resource using PUT requests. Proper handling of resource updates is crucial for maintaining data integrity. For this task, you will learn how to use AutoMapper, a popular object-to-object mapping library. AutoMapper facilitates the mapping between Data Transfer Objects (DTOs) and entity models. AutoMapper also helps us reduce the boilerplate code needed for manual property mapping.

Getting ready

The repository is available here: https://github.com/PacktPublishing/ASP.NET-9-Web-API-Cookbook/tree/main/end/chapter02/AutoMapper. This starter project is different from the one we left off with, so it is crucial that you clone it if you want to follow along. The starter project includes an AdditionalContactInfo model for storing secondary contact details, which we’ll be mapping alongside our main EventRegistration model.

How to do it…

  1. Clone the repository using...
You have been reading a chapter from
ASP.NET Core 9 Web API Cookbook
Published in: Apr 2025
Publisher: Packt
ISBN-13: 9781835880340
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime