You are struggling with basic programming and problem solving. The use case is very simple; If the year is not found in the database then set the count to 1 and set the year to the current year. If the year is found then increment the count and set the year to the current year. This logic should exist behind Web API which includes a Web API action, business logic, data access, or stored procedure. It is possible to add the logic to Blazor but, in my opinion, this is not efficient.
Against my better judgement, I created a working demo on GitHub. THIS IS NOT PRODUCTON CODE!!! The example code is intended to help you write an if statement and LINQ queries.
https://github.com/mjgebhard/WebApiSqlite
Please make an effort to learn C# and LINQ rather than your current programming strategy which is copy, paste, and pray.