using System.Text.Json.Serialization; namespace Bücherwurm { class Book : IProduct { [JsonPropertyName("title")] public string Title {get; set;} [JsonPropertyName("author")] public string Author {get; set;} [JsonPropertyName("country")] public string Country {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;} [JsonIgnore] public int ProductId { get; set; } [JsonIgnore] public string Category { get; set; } [JsonPropertyName("imageLink")] public string ImageLink { get; set; } [JsonIgnore] public int LendTime {get; set;} public Book(int Id, string Title, string Author, string Country, string ILink, string Link, string Language, int Pages, int Year) { ProductId = Id; Category = "book"; LendTime = 30; 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 (ProductId == 0) { ProductId = id; } } } }