예제 #1
0
        private async Task SubmitVideoForm(IBrowserFile file)
        {
            videoSaved = false;

            try
            {
                var videoUrl = await ConsultantProfilesClient.UploadVideoAsync(Guid.Parse(Id), new FileParameter(file.OpenReadStream(), file.Name));

                consultant.ProfileVideo = videoUrl;

                videoSaved = true;

                await videoUploadModal.Close();
            }

            /* catch (ApiException exc)
             * {
             * }
             * catch (HttpRequestException exc)
             * {
             * } */
            catch (Exception exc)
            {
                await JSHelpers.Alert(exc.Message);
            }
        }
예제 #2
0
        private async Task SubmitProfileImageForm(IBrowserFile file)
        {
            videoSaved = false;

            fileName = file.Name;
            stream   = file.OpenReadStream();

            imageSource = Base64ImageEncoder.EncodeImage(stream, file.ContentType);

            if (!string.IsNullOrEmpty(Id))
            {
                try
                {
                    var imageUrl = await ConsultantProfilesClient.UploadProfileImageAsync(Guid.Parse(Id), new FileParameter(stream, fileName));

                    consultant.ProfileImage = imageUrl;

                    videoSaved = true;

                    await imageUploadModal.Close();
                }

                /* catch (ApiException exc)
                 * {
                 * }
                 * catch (HttpRequestException exc)
                 * {
                 * } */
                catch (Exception exc)
                {
                    await JSHelpers.Alert(exc.Message);
                }
            }
        }
예제 #3
0
        private async Task SubmitForm()
        {
            saved = false;
            error = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(Id))
                {
                    var foo = await ConsultantProfilesClient.CreateConsultantProfileAsync(consultant as AddConsultantProfile);

                    consultant = Mapper.Map <UpdateConsultantProfile>(foo);

                    Id = foo.Id.ToString();

                    try
                    {
                        if (stream != null)
                        {
                            var imageUrl = await ConsultantProfilesClient.UploadProfileImageAsync(Guid.Parse(Id), new FileParameter(stream, fileName));

                            consultant.ProfileImage = imageUrl;

                            videoSaved = true;
                        }
                    }

                    /* catch (ApiException exc)
                     * {
                     * }
                     * catch (HttpRequestException exc)
                     * {
                     * } */
                    catch (Exception exc)
                    {
                        await JSHelpers.Alert(exc.Message);
                    }
                }
                else
                {
                    await ConsultantProfilesClient.UpdateConsultantProfileAsync(Guid.Parse(Id), consultant as UpdateConsultantProfile);
                }

                saved = true;
            }

            /* catch (ApiException exc)
             * {
             *
             * }
             * catch (HttpRequestException exc)
             * {
             *
             * } */
            catch (Exception exc)
            {
                saved = false;
                error = exc.Message;
            }
        }
예제 #4
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);
            }
        }