Update: Copy Model hinzugefügt, Controller gefixt

This commit is contained in:
David Renner 2020-05-28 10:31:04 +02:00
parent defdceaf24
commit f76303a1cf
3 changed files with 18 additions and 7 deletions

Binary file not shown.

View File

@ -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
View 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; }
}
}