Next, we'll create a model called Forecast that will keep track of a single forecast for a city. Forecast keeps a list of multiple ForeCastItem objects, each representing a forecast for a specific point in time. Let's set this up:
- In the Weather project, create a new class called Forecast.
- Add the following code:
using System;
using System.Collections.Generic;
namespace Weather.Models
{
public class Forecast
{
public string City { get; set; }
public List<ForecastItem> Items { get; set; }
}
}
Now that we have our models for both the Weather API and the app, we need to fetch data from the Weather API.