Summary
You should now be able to create a hosted Blazor WebAssembly app that uses the 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 project template to create a hosted Blazor WebAssembly app. We examined the demo project and then deleted it from the multi-project solution. We added both a TaskItem
class and a TaskItem
API controller. Next, we configured SQL Server by updating the connection string to the database and using Entity Framework migrations. 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 app that is part of a multi-project solution...