Browse Source

generate ebooks from imports

master
nek0 11 months ago
parent
commit
f04f7f4892
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      Program.cs

+ 10
- 1
Program.cs View File

@ -41,13 +41,22 @@ namespace BuecherwurmAPI
//var importedMags = JsonSerializer.Deserialize<List<Models.BookPost>>(magazinesJson);
List<Models.IProductPost> imports = new List<Models.IProductPost>();
imports.AddRange(importedBooks);
foreach (var item in importedBooks)
{
item.LendType = LendTypeEnum.Virtual;
item.Category = Models.CategoryEnum.EBook;
imports.Add(item);
}
//imports.AddRange(importedMags);
foreach (var item in imports)
{
var id = catalogue.AddProduct(item);
items.NewItem(new Models.ItemPost{ BookId = (int)id});
items.NewItem(new Models.ItemPost{ BookId = (int)id});
if (item.LendType != LendTypeEnum.Virtual)
{
items.NewItem(new Models.ItemPost{ BookId = (int)id});
}
}
}


Loading…
Cancel
Save