Update: Copy Model hinzugefügt, Controller gefixt
This commit is contained in:
parent
defdceaf24
commit
f76303a1cf
3 changed files with 18 additions and 7 deletions
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
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();
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
14
Models/Copy.cs
Normal file
14
Models/Copy.cs
Normal file
|
@ -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…
Reference in a new issue