generate ebooks from imports
This commit is contained in:
parent
f94d8b2c65
commit
f04f7f4892
1 changed files with 10 additions and 1 deletions
|
@ -41,15 +41,24 @@ namespace BuecherwurmAPI
|
||||||
//var importedMags = JsonSerializer.Deserialize<List<Models.BookPost>>(magazinesJson);
|
//var importedMags = JsonSerializer.Deserialize<List<Models.BookPost>>(magazinesJson);
|
||||||
List<Models.IProductPost> imports = new List<Models.IProductPost>();
|
List<Models.IProductPost> imports = new List<Models.IProductPost>();
|
||||||
imports.AddRange(importedBooks);
|
imports.AddRange(importedBooks);
|
||||||
|
foreach (var item in importedBooks)
|
||||||
|
{
|
||||||
|
item.LendType = LendTypeEnum.Virtual;
|
||||||
|
item.Category = Models.CategoryEnum.EBook;
|
||||||
|
imports.Add(item);
|
||||||
|
}
|
||||||
//imports.AddRange(importedMags);
|
//imports.AddRange(importedMags);
|
||||||
|
|
||||||
foreach (var item in imports)
|
foreach (var item in imports)
|
||||||
{
|
{
|
||||||
var id = catalogue.AddProduct(item);
|
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});
|
items.NewItem(new Models.ItemPost{ BookId = (int)id});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void CreateNewEmptyDB()
|
private static void CreateNewEmptyDB()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue