Adding a Forecast Class
Learn how to fetch data from OpenWeather One Call API and display it on the page.
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