diff --git a/Book.cs b/Book.cs index 9079476..64f5814 100644 --- a/Book.cs +++ b/Book.cs @@ -27,7 +27,7 @@ namespace Bücherwurm [JsonIgnore] public int ProductId { get; set; } [JsonIgnore] - public string Category { get; } + public string Category { get; set; } [JsonPropertyName("imageLink")] public string ImageLink { get; set; } diff --git a/Catalogue.cs b/Catalogue.cs index d4ef2cb..f456320 100644 --- a/Catalogue.cs +++ b/Catalogue.cs @@ -19,13 +19,14 @@ namespace Bücherwurm public void Import(string JsonString) { - var IntermediateBooks = JsonSerializer.Deserialize>(JsonString); + var IntermediateBooks = JsonSerializer.Deserialize>(JsonString); foreach (var Ibook in IntermediateBooks) { Ibook.OverwriteNullId(NextId); + Ibook.Category = "book"; NextId += 1; } - Products = IntermediateBooks; + Products = new List(IntermediateBooks); } public void AddBook(string Title, string Author,