fix import for IProduct

This commit is contained in:
nek0 2020-04-27 16:42:56 +02:00
parent c252b91ca6
commit 6df47aa73e
2 changed files with 4 additions and 3 deletions

View file

@ -27,7 +27,7 @@ namespace Bücherwurm
[JsonIgnore] [JsonIgnore]
public int ProductId { get; set; } public int ProductId { get; set; }
[JsonIgnore] [JsonIgnore]
public string Category { get; } public string Category { get; set; }
[JsonPropertyName("imageLink")] [JsonPropertyName("imageLink")]
public string ImageLink { get; set; } public string ImageLink { get; set; }

View file

@ -19,13 +19,14 @@ namespace Bücherwurm
public void Import(string JsonString) public void Import(string JsonString)
{ {
var IntermediateBooks = JsonSerializer.Deserialize<List<IProduct>>(JsonString); var IntermediateBooks = JsonSerializer.Deserialize<List<Book>>(JsonString);
foreach (var Ibook in IntermediateBooks) foreach (var Ibook in IntermediateBooks)
{ {
Ibook.OverwriteNullId(NextId); Ibook.OverwriteNullId(NextId);
Ibook.Category = "book";
NextId += 1; NextId += 1;
} }
Products = IntermediateBooks; Products = new List<IProduct>(IntermediateBooks);
} }
public void AddBook(string Title, string Author, public void AddBook(string Title, string Author,