public ActionResult <bool> DeleteToy(int id) { try { var res = service.DeleteToy(id); return(Ok(res)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));; } }
public async Task <ActionResult> DeleteToy(int id) { bool isDeleted = await _toyService.DeleteToy(id); if (isDeleted) { return(StatusCode(204)); } else { return(StatusCode(400)); } }