Example #1
0
        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);
            }
        }