public async Task <ActionResult <DeleteModel> > DeletecompanyAsync(int companyId) { try { return(Ok(await _companyService.DeleteCompanyAsync(companyId))); } catch (NotFoundOperationException ex) { return(NotFound(ex.Message));; } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, $"Something happend: {ex.Message}")); } }
//private void OnAddCompany() //{ // AddCompanyRequested(new Company()); //} //private void OnEditCompany(Company company) //{ // EditCompanyRequested(company); //} private async void OnDeleteCompany(Company company) { if (Deleting()) { try { await _companiesService.DeleteCompanyAsync(company.CompanyId); Companies.Remove(company); Deleted(); } catch (Exception ex) { Failed(ex); } } }