private async Task SubmitForm() { saved = false; error = string.Empty; try { if (string.IsNullOrEmpty(Id)) { await ClientProfilesClient.CreateClientProfileAsync(client as AddClientProfile); NavigationManager.NavigateTo("/clients"); } else { await ClientProfilesClient.UpdateClientProfileAsync(Guid.Parse(Id), client as UpdateClientProfile); saved = true; } } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { saved = false; error = exc.Message; } }
private async Task InitializeAsync() { userProfile = await IdentityService.GetUserProfileAsync(); if (!string.IsNullOrEmpty(Id)) { if (Guid.TryParse(Id, out var id)) { try { client = Mapper.Map <UpdateClientProfile>( await ClientProfilesClient.GetClientProfileAsync(Guid.Parse(Id))); if (client.Address == null) { client.Address = new Address(); } } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } } else { // Handle expected guid } } else { client = new AddClientProfile() { Address = new Address() }; } try { organizations = await OrganizationsClient.GetOrganizationsAsync(); } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } try { managers = await ManagersClient.GetManagersAsync(null); } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } }