Working delete and hide of the post

This commit is contained in:
2017-06-12 16:15:34 +03:00
parent b1dcf5f72d
commit 41991a68dd
4 changed files with 45 additions and 13 deletions

View File

@@ -54,12 +54,25 @@ namespace WebApi.Controllers
public IHttpActionResult Put(int id, [FromBody]FoorumDTO foorum)
{
foorum.FoorumId = id;
return Ok(_foorumService.Update(foorum));
var updatedFoorum = _foorumService.Update(foorum);
if (updatedFoorum == null)
{
return NotFound();
}
return Ok(updatedFoorum);
}
// DELETE api/<controller>/5
public void Delete(int id)
public void Delete(int id, [FromUri]bool permanent=false)
{
if (permanent)
{
_foorumService.Delete(id);
}
else
{
_foorumService.Hide(id);
}
}
}
}