Added inventary data

This commit is contained in:
Naumann 2020-05-28 15:50:14 +02:00
commit f16154cf0a
4 changed files with 102 additions and 89 deletions

View File

@ -11,9 +11,9 @@ namespace BuecherwurmAPI.Controllers
[ApiController]
public class InventarController : ControllerBase
{
private readonly IInventarRepo _repository;
private readonly IItemRepo _repository;
public InventarController(IInventarRepo repository)
public InventarController(IItemRepo repository)
{
_repository = repository;
}
@ -32,7 +32,7 @@ namespace BuecherwurmAPI.Controllers
return Ok(new Item
{
Id = item.Id,
BookId = item.BookId,
BookId = book.ProductId,
});
}
@ -60,7 +60,7 @@ namespace BuecherwurmAPI.Controllers
{
return NotFound();
}
_repository.DeleteItem(item);
_repository.DeleteItems(item);
return NoContent();
}

13
Data/IItemRepo.cs Normal file
View File

@ -0,0 +1,13 @@
using System.Collections.Generic;
using BuecherwurmAPI.Models;
namespace BuecherwurmAPI.Data
{
public interface IItemRepo
{
IEnumerable<Item> GetAllItems();
Item GetItemById(int id);
NewItem(Item item);
DeleteItem(int id);
}
}