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