implement epapers
This commit is contained in:
parent
2811aa4e71
commit
48bb08bd88
2 changed files with 34 additions and 4 deletions
15
Catalogue.cs
15
Catalogue.cs
|
@ -39,14 +39,21 @@ namespace Bücherwurm
|
||||||
|
|
||||||
public void ImportMagazines(string JsonString)
|
public void ImportMagazines(string JsonString)
|
||||||
{
|
{
|
||||||
var IntermediateBooks = JsonSerializer.Deserialize<List<Magazine>>(JsonString);
|
var IntermediateMagazines = JsonSerializer.Deserialize<List<Magazine>>(JsonString);
|
||||||
foreach (var Ibook in IntermediateBooks)
|
foreach (var Ibook in IntermediateMagazines)
|
||||||
{
|
{
|
||||||
Ibook.OverwriteNullId(NextId);
|
Ibook.OverwriteNullId(NextId);
|
||||||
NextId += 1;
|
NextId += 1;
|
||||||
}
|
}
|
||||||
Products.AddRange(new List<IProduct>(IntermediateBooks));
|
Products.AddRange(new List<IProduct>(IntermediateMagazines));
|
||||||
|
var ePapers = new List<EPaper>();
|
||||||
|
foreach (var mag in IntermediateMagazines)
|
||||||
|
{
|
||||||
|
var epaper = new EPaper(mag);
|
||||||
|
epaper.OverwriteNullId(NextId);
|
||||||
|
NextId += 1;
|
||||||
|
}
|
||||||
|
Products.AddRange(new List<IProduct>(ePapers));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddBook(string Title, string Author,
|
public void AddBook(string Title, string Author,
|
||||||
|
|
23
EPaper.cs
Normal file
23
EPaper.cs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
namespace Bücherwurm
|
||||||
|
{
|
||||||
|
public class EPaper : Magazine, IProduct
|
||||||
|
{
|
||||||
|
public EPaper()
|
||||||
|
{
|
||||||
|
Category = CategoryEnum.EPaper;
|
||||||
|
LendTime = 2;
|
||||||
|
LendType = LendTypeEnum.Virtual;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EPaper(Magazine Parent)
|
||||||
|
{
|
||||||
|
Category = CategoryEnum.EPaper;
|
||||||
|
LendTime = 2;
|
||||||
|
LendType = LendTypeEnum.Virtual;
|
||||||
|
Name = Parent.Name;
|
||||||
|
Run = Parent.Run;
|
||||||
|
Audience = Parent.Audience;
|
||||||
|
Topic = Parent.Topic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue