Compare commits

..

No commits in common. "master" and "Felix" have entirely different histories.

3 changed files with 4 additions and 13 deletions

2
.gitignore vendored
View File

@ -11,8 +11,6 @@
*.userosscache
*.sln.docstates
*.db
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

View File

@ -121,7 +121,7 @@ namespace BuecherwurmAPI.Models
using (var command = _dbConnection.CreateCommand())
{
command.Parameters.Add(new SqliteParameter("@id", id));
command.CommandText = @"DELETE FROM Products WHERE ProductId= @id";
command.CommandText = @"DELETE FROM Books WHERE ProductId= @id";
var dataReader = command.ExecuteReader();
}
}
@ -130,6 +130,8 @@ namespace BuecherwurmAPI.Models
{
using (var command = _dbConnection.CreateCommand())
{
// funktioniert das so?
//muss ProduktId übergeben werden? -> ProductId wird weiter hinten mit 'NULL' befüllt, damit die ID automatisch vergeben wird.
command.CommandText = @"INSERT INTO Products (ProductId, Title, Author, Country, Link, Language, Pages, Year, Category, ImageLink, LendTime, LendType, Run, Audience, Topic) VALUES (NULL, @Title, @Author, @Country, @Link, @Language, @Pages, @Year, @Category, @ImageLink, @LendTime, @LendType, @Run, @Audience, @Topic)";
command.Parameters.Add(new SqliteParameter("@Title", book.Title));

View File

@ -41,22 +41,13 @@ 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});
if (item.LendType != LendTypeEnum.Virtual)
{
items.NewItem(new Models.ItemPost{ BookId = (int)id});
}
items.NewItem(new Models.ItemPost{ BookId = (int)id});
}
}