Update: Benennungen angepasst - Copy --> Item
This commit is contained in:
parent
f76303a1cf
commit
d827332311
3 changed files with 19 additions and 19 deletions
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
|
@ -19,32 +19,32 @@ namespace BuecherwurmAPI.Controllers
|
||||||
}
|
}
|
||||||
// GET Inventar
|
// GET Inventar
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public ActionResult<IEnumerable<Copy>> GetAllCopies()
|
public ActionResult<IEnumerable<Item>> GetAllItems()
|
||||||
{
|
{
|
||||||
var copies = _repository.GetAllCopies();
|
var items = _repository.GetAllItems();
|
||||||
return Ok(copies);
|
return Ok(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST Inventar
|
// POST Inventar
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult<IEnumerable<Copy>> NeuesExemplar(Copy copy)
|
public ActionResult<IEnumerable<Item>> NewItem(Item item)
|
||||||
{
|
{
|
||||||
return Ok(new Copy
|
return Ok(new Item
|
||||||
{
|
{
|
||||||
CopyId = copy.CopyId,
|
Id = item.Id,
|
||||||
ProductId = book.ProductId,
|
BookId = book.ProductId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GET Inventar/{id}
|
// GET Inventar/{id}
|
||||||
[HttpGet("{id}", Name = "GetCopyByID")]
|
[HttpGet("{id}", Name = "GetItemByID")]
|
||||||
public ActionResult<IEnumerable<Copy>> GetCopyByID(int id)
|
public ActionResult<IEnumerable<Item>> GetItemByID(int id)
|
||||||
{
|
{
|
||||||
var copy = _repository.GetCopyById(id);
|
var item = _repository.GetItemById(id);
|
||||||
if (copy != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
return Ok(copy);
|
return Ok(item);
|
||||||
}
|
}
|
||||||
return NoContent();
|
return NoContent();
|
||||||
|
|
||||||
|
@ -53,14 +53,14 @@ namespace BuecherwurmAPI.Controllers
|
||||||
|
|
||||||
// DELETE inventory/{id}
|
// DELETE inventory/{id}
|
||||||
[HttpDelete("id")]
|
[HttpDelete("id")]
|
||||||
public ActionResult<IEnumerable<Copy>> ExemplarEntfernen(int id)
|
public ActionResult<IEnumerable<Item>> DeleteItem(int id)
|
||||||
{
|
{
|
||||||
var copy = _repository.GetCopyById(id);
|
var item = _repository.GetItemById(id);
|
||||||
if (copy == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
_repository.ExemplarEntfernen(copy);
|
_repository.DeleteItem(Item);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,13 @@ using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace BuecherwurmAPI.Models
|
namespace BuecherwurmAPI.Models
|
||||||
{
|
{
|
||||||
public class Copy
|
public class Item
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
[Required]
|
[Required]
|
||||||
public int CopyId { get; set; }
|
public int Id { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int ProductId { get; set; }
|
public int BookId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue