Summary
You should now be able to create a hosted Blazor WebAssembly app that uses ASP.NET Web API to update data in a SQL Server database.
In this chapter, we introduced hosted Blazor WebAssembly apps, the HttpClient service, and the JSON helper methods used to read, create, and update data. We also demonstrated how to delete data using the HttpClient.DeleteAsync method.
After that, we used Microsoft’s Blazor WebAssembly App Empty project template to create a hosted Blazor WebAssembly app. We added a TaskItem class to the TaskManager.Shared project and a TaskItem API controller to the TaskManager.Server project. Next, we configured SQL Server by updating the connection string to the database and using Entity Framework migrations. To enhance the UI, we added Bootstrap and Bootstrap icons. Finally, we used the HttpClient service to read the list of tasks, update a task, delete a task, and add new tasks.
We can apply our new skills to create a hosted Blazor WebAssembly...