Update: Benennungen angepasst - Copy --> Item

This commit is contained in:
David Renner 2020-05-28 10:38:21 +02:00
parent f76303a1cf
commit d827332311
3 changed files with 19 additions and 19 deletions

Binary file not shown.

View file

@ -19,32 +19,32 @@ namespace BuecherwurmAPI.Controllers
}
// GET Inventar
[HttpGet]
public ActionResult<IEnumerable<Copy>> GetAllCopies()
public ActionResult<IEnumerable<Item>> GetAllItems()
{
var copies = _repository.GetAllCopies();
return Ok(copies);
var items = _repository.GetAllItems();
return Ok(items);
}
// POST Inventar
[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,
ProductId = book.ProductId,
Id = item.Id,
BookId = book.ProductId,
});
}
// GET Inventar/{id}
[HttpGet("{id}", Name = "GetCopyByID")]
public ActionResult<IEnumerable<Copy>> GetCopyByID(int id)
[HttpGet("{id}", Name = "GetItemByID")]
public ActionResult<IEnumerable<Item>> GetItemByID(int id)
{
var copy = _repository.GetCopyById(id);
if (copy != null)
var item = _repository.GetItemById(id);
if (item != null)
{
return Ok(copy);
return Ok(item);
}
return NoContent();
@ -53,14 +53,14 @@ namespace BuecherwurmAPI.Controllers
// DELETE inventory/{id}
[HttpDelete("id")]
public ActionResult<IEnumerable<Copy>> ExemplarEntfernen(int id)
public ActionResult<IEnumerable<Item>> DeleteItem(int id)
{
var copy = _repository.GetCopyById(id);
if (copy == null)
var item = _repository.GetItemById(id);
if (item == null)
{
return NotFound();
}
_repository.ExemplarEntfernen(copy);
_repository.DeleteItem(Item);
return NoContent();
}

View file

@ -2,13 +2,13 @@ using System.ComponentModel.DataAnnotations;
namespace BuecherwurmAPI.Models
{
public class Copy
public class Item
{
[Key]
[Required]
public int CopyId { get; set; }
public int Id { get; set; }
[Required]
public int ProductId { get; set; }
public int BookId { get; set; }
}
}