Browse Source

added new Methodes to KatalogModel

Amedeo
Naumann 2 years ago
parent
commit
226faafafc
  1. 16
      Models/KatalogModel.cs
  2. 3
      Models/Lend.cs

16
Models/KatalogModel.cs

@ -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)

3
Models/Lend.cs

@ -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…
Cancel
Save