Return proper http status codes on delete

This commit is contained in:
2017-06-12 16:23:33 +03:00
parent 41991a68dd
commit 1249950059
3 changed files with 30 additions and 9 deletions

View File

@@ -63,16 +63,25 @@ namespace WebApi.Controllers
}
// DELETE api/<controller>/5
public void Delete(int id, [FromUri]bool permanent=false)
public IHttpActionResult Delete(int id, [FromUri]bool permanent=false)
{
FoorumDTO f = null;
if (permanent)
{
_foorumService.Delete(id);
f =_foorumService.Delete(id);
}
else
{
_foorumService.Hide(id);
}
f = _foorumService.Hide(id);
}
if (f == null)
{
return NotFound();
}
return Ok(f);
}
}
}