Added inventary data
This commit is contained in:
commit
f16154cf0a
4 changed files with 102 additions and 89 deletions
|
@ -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
13
Data/IItemRepo.cs
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue