added new Methodes to KatalogModel
This commit is contained in:
parent
1637f45d0e
commit
226faafafc
2 changed files with 17 additions and 2 deletions
|
@ -76,12 +76,24 @@ namespace BuecherwurmAPI.Models
|
|||
}
|
||||
public void DeleteBook(Book book)
|
||||
{
|
||||
|
||||
using (var command = _dbConnection.CreateCommand())
|
||||
{
|
||||
// funktioniert das so?
|
||||
command.Parameters.Add(new SqliteParameter("@id", SqliteType.Integer)).Value = book.ProductId;
|
||||
command.CommandText = @"DELETE * FROM Books WHERE ProductId= @id";
|
||||
var dataReader = command.ExecuteReader();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddBook (Book book)
|
||||
{
|
||||
|
||||
using (var command = _dbConnection.CreateCommand())
|
||||
{
|
||||
// funktioniert das so?
|
||||
command.Parameters.Add(new SqliteParameter("@id", SqliteType.Integer)).Value = book.ProductId;
|
||||
command.CommandText = @"INSERT INTO Books (Name, Author, Country, Link, Language, Pages, Year, ProductId, Category, ImageLink, LendTime, LendType) ";
|
||||
var dataReader = command.ExecuteReader();
|
||||
}
|
||||
}
|
||||
|
||||
public void EditBook (Book book)
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BuecherwurmAPI.Models
|
||||
{
|
||||
public class Lend
|
||||
{
|
||||
[Key]
|
||||
[Required]
|
||||
public long Id { get; set; }
|
||||
public long ItemId { get; set;}
|
||||
public DateTime ReturnDate { get; set; }
|
||||
|
|
Loading…
Reference in a new issue