public async Task <IHttpActionResult> Delete(int id) { var flag = await processorService.GetById(id); if (flag == null) { return(NotFound()); } try { if (!await processorService.DeleteCheckOnEntity(id)) { await processorService.Delete(id); } else { throw new Exception("Exist ForeingKeys"); } return(Ok()); } catch (Exception e) { return(InternalServerError(e)); } }