Learn CRUD in .NET MAUI with JWT Authentication (Full Tutorial)

Fox Learn Guide 8 months ago

Description

Complete CRUD App in .NET MAUI — Connected to JWT Web API

In this video, we continue our .NET MAUI series by building full CRUD operations connected to a JWT-secured Web API.

In the previous episode, we set up the API and authentication.
Now, we’ll implement Create, Read, Update, and Delete operations from a MAUI client, using HttpClient, AuthorizedHandler, and clean architecture with services and models.

Here’s what we’ll cover:

🔹 Build the Product model and configure Entity Framework
- Create the Product class
- Add DbSet in ApplicationDbContext
- Run migrations to generate tables

🔹 Generate a fully functional Products API
- Scaffold an EF-based controller
- Apply the [Authorize] attribute
- Test endpoints in Swagger

🔹 Implement CRUD in .NET MAUI
- Create IProductService and ProductService
- Call the API using HttpClient
- Handle POST, GET, PUT, and DELETE with JSON serialization
- Add a DelegatingHandler to attach JWT tokens automatically

🔹 Build the ProductFormPage UI
- Form fields for ProductId, Name, and Price
- Save and Cancel actions
- Load data when editing
- Create or update records using the service

🔹 Update the MainPage for listing and managing products
- Display product list with CollectionView
- Add new product
- Edit existing product
- Delete products with confirmation dialogs
- Reload data on page appearing

🔹 Finish with MAUI dependency injection & routing
- Register services in MauiProgram.cs
- Add AuthorizedHandler
- Define Shell routes

Finally, we run the app on the Android emulator and test all CRUD features end-to-end.

If you find this tutorial helpful, please like, subscribe, and leave a comment below.
Thanks for watching, and see you in the next video! 🚀