From 48bb08bd8816774c5010a665931907d1a67917e1 Mon Sep 17 00:00:00 2001 From: nek0 Date: Tue, 28 Apr 2020 16:07:03 +0200 Subject: [PATCH] implement epapers --- Catalogue.cs | 15 +++++++++++---- EPaper.cs | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 EPaper.cs diff --git a/Catalogue.cs b/Catalogue.cs index 56d2559..164ef9c 100644 --- a/Catalogue.cs +++ b/Catalogue.cs @@ -39,14 +39,21 @@ namespace Bücherwurm public void ImportMagazines(string JsonString) { - var IntermediateBooks = JsonSerializer.Deserialize>(JsonString); - foreach (var Ibook in IntermediateBooks) + var IntermediateMagazines = JsonSerializer.Deserialize>(JsonString); + foreach (var Ibook in IntermediateMagazines) { Ibook.OverwriteNullId(NextId); NextId += 1; } - Products.AddRange(new List(IntermediateBooks)); - + Products.AddRange(new List(IntermediateMagazines)); + var ePapers = new List(); + foreach (var mag in IntermediateMagazines) + { + var epaper = new EPaper(mag); + epaper.OverwriteNullId(NextId); + NextId += 1; + } + Products.AddRange(new List(ePapers)); } public void AddBook(string Title, string Author, diff --git a/EPaper.cs b/EPaper.cs new file mode 100644 index 0000000..1f241d8 --- /dev/null +++ b/EPaper.cs @@ -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; + } + } +} \ No newline at end of file