catched 304
This commit is contained in:
parent
de7bc0871d
commit
7fc04455f6
1 changed files with 19 additions and 3 deletions
|
@ -23,15 +23,31 @@ namespace BuecherwurmAPI.Controllers
|
|||
public ActionResult<IEnumerable<Item>> GetAllItems()
|
||||
{
|
||||
var items = _repository.GetAllItems();
|
||||
return Ok(items);
|
||||
if (items != null)
|
||||
{
|
||||
return Ok(items);
|
||||
}
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
// POST Inventar
|
||||
[HttpPost]
|
||||
public ActionResult<IEnumerable<Item>> NewItem(ItemPost item)
|
||||
{
|
||||
var newItem = _repository.NewItem(item);
|
||||
return Ok(newItem);
|
||||
try
|
||||
{
|
||||
var newItem = _repository.NewItem(item);
|
||||
if (item != null)
|
||||
{
|
||||
return Ok(newItem);
|
||||
}
|
||||
return NotFound();
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
return StatusCode(304); //not Modified
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue