diff --git a/Book.cs b/Book.cs index 3033f69..5213203 100644 --- a/Book.cs +++ b/Book.cs @@ -35,9 +35,16 @@ namespace Bücherwurm [JsonIgnore] public LendTypeEnum LendType {get; set;} - public Book(int Id, string Title, string Author, - string Country, string ILink, string Link, string Language, - int Pages, int Year) + public Book( + int Id, + string Title, + string Author, + string Country, + string ILink, + string Link, + string Language, + int Pages, + int Year) { ProductId = Id; Category = CategoryEnum.Book; diff --git a/Catalogue.cs b/Catalogue.cs index b0bf483..e5672cd 100644 --- a/Catalogue.cs +++ b/Catalogue.cs @@ -57,12 +57,32 @@ namespace Bücherwurm Products.AddRange(new List(ePapers)); } - public void AddBook(string Title, string Author, - string Country, string ILink, string Link, - string Language, int Pages, int Year) + public void AddManualBook( + string Title, + string Author, + string Country, + string ILink, + string Link, + string Language, + int Pages, + int Year) { - Products.Add(new Book(NextId, Title, Author, Country, ILink, Link, Language, Pages, Year)); - NextId = NextId++; + var newBook = new Book(NextId, Title, Author, Country, ILink, Link, Language, Pages, Year); + Products.Add(newBook); + Products.Add(new EBook(newBook)); + NextId += 1; + } + + public void AddManualMagazine( + string Title, + string Run, + string Audience, + string Topic) + { + var newMagazine = new Magazine(NextId, Title, Run, Audience, Topic); + Products.Add(newMagazine); + Products.Add(new EPaper(newMagazine)); + NextId += 1; } public void Add(IProduct product) diff --git a/Item.cs b/Item.cs index af1f57e..bb1f2e2 100644 --- a/Item.cs +++ b/Item.cs @@ -8,7 +8,9 @@ namespace Bücherwurm public StatusEnum Status {get; set;} - public Item(int Id, int BookId) + public Item( + int Id, + int BookId) { ItemId = Id; this.ProdId = BookId; diff --git a/Lend_Administration.cs b/Lend_Administration.cs index 8f15511..b522068 100644 --- a/Lend_Administration.cs +++ b/Lend_Administration.cs @@ -17,7 +17,10 @@ namespace Bücherwurm NextId = 1; } - public void Lend(int ItemId, string Customer, int timeInDays) + public void Lend( + int ItemId, + string Customer, + int timeInDays) { Lendings.Add(new Lending(NextId, ItemId, Customer, timeInDays)); ActiveLendings.Add(NextId); diff --git a/Lending.cs b/Lending.cs index 59f4163..8c03dce 100644 --- a/Lending.cs +++ b/Lending.cs @@ -12,7 +12,11 @@ namespace Bücherwurm public string Customer {get; } - public Lending(int Id, int Item, string Customer, int timeInDays) + public Lending( + int Id, + int Item, + string Customer, + int timeInDays) { LendId = Id; LendItem = Item; diff --git a/Magazine.cs b/Magazine.cs index f79137c..684a2a8 100644 --- a/Magazine.cs +++ b/Magazine.cs @@ -41,5 +41,22 @@ namespace Bücherwurm LendTime = 2; LendType = LendTypeEnum.Physical; } + + public Magazine( + int ProductId, + string Title, + string Run, + string Audience, + string Topic) + { + Category = CategoryEnum.Magazine; + LendTime = 2; + LendType = LendTypeEnum.Physical; + this.ProductId = ProductId; + Name = Title; + this.Run = Run; + this.Audience = Audience; + this.Topic = Topic; + } } } \ No newline at end of file