public async Task <IHttpActionResult> Delete(int id) { try { var supplier = await _repository.GetSuppliersAsync(id); if (supplier != null) { _repository.DeleteSupplier(supplier); if (await _repository.SaveChangesAsync()) { return(Ok(string.Format("Supplier with id {0} has been deleted", id))); } else { return(Content(HttpStatusCode.Conflict, string.Format("Supplier with id {0} could not be deleted", id))); } } else { return(Content(HttpStatusCode.NotFound, string.Format("Supplier with id {0} could not be found", id))); } } catch { return(InternalServerError()); } }