Buecherwurm/Book.cs

62 lines
1.4 KiB
C#

using System.Text.Json.Serialization;
namespace Bücherwurm
{
class Book
{
[JsonIgnoreAttribute]
public int BookId {get; set;}
[JsonPropertyName("title")]
public string Title {get; set;}
[JsonPropertyName("author")]
public string Author {get; set;}
[JsonPropertyName("country")]
public string Country {get; set;}
[JsonPropertyName("imageLink")]
public string ImageLink {get; set;}
[JsonPropertyName("link")]
public string Link {get; set;}
[JsonPropertyName("language")]
public string Language {get; set;}
[JsonPropertyName("pages")]
public int Pages {get; set;}
[JsonPropertyName("year")]
public int Year {get; set;}
public Book(int Id, string Title, string Author,
string Country, string ILink, string Link, string Language,
int Pages, int Year)
{
BookId = Id;
this.Title = Title;
this.Author = Author;
this.Country = Country;
ImageLink = ILink;
this.Link = Link;
this.Language = Language;
this.Pages = Pages;
this.Year = Year;
}
public Book()
{
}
public void OverwriteNullId(int Id)
{
if (BookId == 0)
{
BookId = Id;
}
}
}
}