public IHttpActionResult Delete(int id) { try { if (id <= 0) { return(BadRequest()); } var work = workService.GetByID(id); if (work != null) { workService.Delete(work); workService.Save(); return(Content(HttpStatusCode.NoContent, work)); } else { return(NotFound()); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }