public ActionResult Delete(string id) { var inspection = _context.Inspections.SingleOrDefault(i => i.WorkOrderId == id); if (inspection == null) { return(NoContent()); } var webRootPath = _env.WebRootPath; var wasSuccessful = InspectionService.DeleteInspection(_context, inspection, webRootPath); return(wasSuccessful ? NoContent() : StatusCode(500)); }