The data returned from the API needs to go somewhere, and the most convenient way of accessing it would be to deserialize the data into POCO objects (Plain Old CLR Objects, also known as regular C# classes). These POCO objects we usually call models, and they usually like to live in a folder called Models. Let's create our models:
- In the News project, create a new folder called Models.
- In the Models folder, add a new class called NewsApiModels.
- Add the following code to the class:
using System;
using System.Collections.Generic;
namespace News.Models
{
public class Source
{
public string Id { get; set; }
public string Name { get; set; }
}
public class Article
{
public Source Source { get; set; }
public string Author { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public string UrlToImage { get; set; }
public DateTime...