This commit is contained in:
nek0 2020-06-03 09:33:07 +02:00
parent a8b1761867
commit de7bc0871d
2 changed files with 1 additions and 3 deletions

View file

@ -11,7 +11,6 @@ namespace BuecherwurmAPI.Models
} }
public class ItemPost public class ItemPost
{ {
[Required]
public int BookId { get; set; } public int BookId { get; set; }
} }

View file

@ -98,8 +98,7 @@ namespace BuecherwurmAPI.Models
command.Parameters.Add(new SqliteParameter("@bookId", itemPost.BookId)); command.Parameters.Add(new SqliteParameter("@bookId", itemPost.BookId));
command.ExecuteNonQuery(); command.ExecuteNonQuery();
command.CommandText = "select last_insert_rowid()"; command.CommandText = "select last_insert_rowid()";
Int64 LastRowId64 = (Int64)command.ExecuteScalar(); var LastRowId64 = (long)command.ExecuteScalar();
long LastRowId = (long)LastRowId64;
var item = new Item{ var item = new Item{
ItemId = LastRowId64, ItemId = LastRowId64,
BookId = itemPost.BookId BookId = itemPost.BookId