Adding a Forecast Class
Explore how to build a Forecast class and a DailyForecast Razor component for a Blazor PWA weather app. Learn to fetch data from the OpenWeather One Call API and display daily forecasts using Bootstrap cards. Understand how to integrate and update the application to show accurate weather information.
We'll cover the following...
We'll cover the following...
We need to add a Forecast class to capture the results from the OpenWeather One Call API. We will do this by following these steps:
- Return to Visual Studio.
- Right-click the
Modelsfolder and select the “Add, Class” option from the menu. - Name the new class
OpenWeather. - Add the following classes:
The preceding classes will be used with the OpenWeather One Call API.
Adding a DailyForecast component
We need a component to display each day’s forecast. We will do this by following these steps:
- Right-click the
Sharedfolder and select the “Add, Razor Component” option from the menu. - Name the new component
DailyForecast. - Replace