Browse Source

catched 304

David
David Renner 2 years ago
parent
commit
7fc04455f6
  1. 22
      Controllers/ItemController.cs

22
Controllers/ItemController.cs

@ -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…
Cancel
Save