Update: Copy Model hinzugefügt, Controller gefixt

InventarDavid
David Renner 2 years ago
parent defdceaf24
commit f76303a1cf
  1. BIN
      .vs/slnx.sqlite
  2. 11
      Controllers/InventarController.cs
  3. 14
      Models/Copy.cs

Binary file not shown.

@ -19,7 +19,7 @@ namespace BuecherwurmAPI.Controllers
}
// GET Inventar
[HttpGet]
public ActionResult<IEnumerable<>> GetAllCopies()
public ActionResult<IEnumerable<Copy>> GetAllCopies()
{
var copies = _repository.GetAllCopies();
return Ok(copies);
@ -27,15 +27,12 @@ namespace BuecherwurmAPI.Controllers
// POST Inventar
[HttpPost]
public ActionResult<IEnumerable<Book>> NeuesExemplar(Copy copy)
public ActionResult<IEnumerable<Copy>> NeuesExemplar(Copy copy)
{
return Ok(new Copy
{
CopyId = copy.CopyId,
ProductId = book.ProductId,
LendTime = copy.LendTime,
LendType = copy.LendType
});
}
@ -55,7 +52,7 @@ namespace BuecherwurmAPI.Controllers
// DELETE inventory/{id}
/*[HttpDelete("id")]
[HttpDelete("id")]
public ActionResult<IEnumerable<Copy>> ExemplarEntfernen(int id)
{
var copy = _repository.GetCopyById(id);
@ -65,7 +62,7 @@ namespace BuecherwurmAPI.Controllers
}
_repository.ExemplarEntfernen(copy);
return NoContent();
}*/
}
}

@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace BuecherwurmAPI.Models
{
public class Copy
{
[Key]
[Required]
public int CopyId { get; set; }
[Required]
public int ProductId { get; set; }
}
}
Loading…
Cancel
Save