Working delete and hide of the post
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user