async Task SubmitForm() { saved = false; error = string.Empty; try { if (string.IsNullOrEmpty(Id)) { await CompetenceAreasClient.CreateCompetenceAreaAsync(competenceArea); NavigationManager.NavigateTo("/competenceareas"); } else { await CompetenceAreasClient.UpdateCompetenceAreaAsync(Id, competenceArea); saved = true; } } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { saved = false; error = exc.Message; } }
private async Task Initialize() { if (!string.IsNullOrEmpty(Id)) { try { competenceArea = await CompetenceAreasClient.GetCompetenceAreaAsync(Id); } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } } else { competenceArea = new CompetenceArea(); } }
private async Task OnInitialize() { userProfile = await IdentityService.GetUserProfileAsync(); if (!string.IsNullOrEmpty(Id)) { if (Guid.TryParse(Id, out var id)) { try { consultant = Mapper.Map <UpdateConsultantProfile>( await ConsultantProfilesClient.GetConsultantProfileAsync(id)); if (consultant.Address == null) { consultant.Address = new Address(); } } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } } else { // Handle expected guid } } else { consultant = new AddConsultantProfile() { Address = new Address() }; } try { competenceAreas = await CompetenceAreasClient.GetCompetenceAreasAsync(); } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } 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); } }
private async Task OnInitialize() { try { var foo = Mapper.ProjectTo <Models.ListItem>(( await CompetenceAreasClient.GetCompetenceAreasAsync()).AsQueryable()).ToList(); foo.Insert(0, new Models.ListItem() { Id = null, Name = "All" }); competenceAreas = foo; competenceArea = competenceAreas.FirstOrDefault(); } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } try { var foo = Mapper.ProjectTo <Models.ListItem>(( await OrganizationsClient.GetOrganizationsAsync()).AsQueryable()).ToList(); foo.Insert(0, new Models.ListItem() { Id = null, Name = "All" }); organizations = foo; organization = organizations.FirstOrDefault(); } /*catch (ApiException exc) * { * * } * catch (HttpRequestException exc) * { * * }*/ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } try { var result = await ConsultantGalleryClient.GetConsultantsAsync(pageNumber ++, numberOfItemsPerPage, null, null, null); consultants = new List <ProfileShort>(); consultants.AddRange(result.Items); total = result.TotalItems; } /*catch (ApiException exc) * { * * } * catch (HttpRequestException exc) * { * * }*/ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } }