Return proper http status codes on delete
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user