fix import for IProduct
This commit is contained in:
parent
c252b91ca6
commit
6df47aa73e
2 changed files with 4 additions and 3 deletions
2
Book.cs
2
Book.cs
|
@ -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; }
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue