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]
public int ProductId { get; set; }
[JsonIgnore]
public string Category { get; }
public string Category { get; set; }
[JsonPropertyName("imageLink")]
public string ImageLink { get; set; }

View File

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