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 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); } }
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); } } }
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; } }
private async Task OnInitalize() { if (!string.IsNullOrEmpty(Id)) { try { organization = await OrganizationsClient.GetOrganizationAsync(Id); if (organization.Address == null) { organization.Address = new Address(); } } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } } else { organization = new Organization() { Address = new Address() }; } }
private async Task OnInitialize() { userProfile = await IdentityService.GetUserProfileAsync(); if (!string.IsNullOrEmpty(Id)) { if (Guid.TryParse(Id, out var id)) { try { manager = Mapper.Map <UpdateManagerProfile>(await ManagersClient.GetManagerAsync(id)); if (manager.Address == null) { manager.Address = new Address(); } } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } } else { // Handle expected guid } } else { manager = new AddManagerProfile() { Address = new Address() }; } try { organizations = await OrganizationsClient.GetOrganizationsAsync(); } /* catch (ApiException exc) * { * } * catch (HttpRequestException exc) * { * } */ catch (Exception exc) { await JSHelpers.Alert(exc.Message); } }
private async Task OnInitialize() { try { var result = await UserClient.GetUserProfileAsync(null); switch (result) { case ClientProfile cp: user = Mapper.Map <UpdateClientProfile>(cp); break; case ConsultantProfile cp: user = Mapper.Map <UpdateConsultantProfile>(cp); break; case ManagerProfile cp: user = Mapper.Map <UpdateManagerProfile>(cp); break; default: user = Mapper.Map <UpdateUserProfile>(result); break; } if (user.Address == null) { user.Address = new Address(); } } /* 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); } }