private void ShowVolunteerSuggestionPopup(long projectDetailActivityId) { try { VolunteerSuggestionFilterDTO filter = new VolunteerSuggestionFilterDTO { ProjectDetailActivityId = projectDetailActivityId }; ServiceResult <VolunteerSuggestionDTO> serviceResult = new ServiceResult <VolunteerSuggestionDTO>(); var queryString = new Dictionary <string, string>(); var response = ApiHelper.CallSendApiMethod(ApiKeys.ProjectApiUrl, "GetVolunteerSuggestion", queryString, filter); if (!response.IsSuccessStatusCode) { throw new Exception("Hata oluştu!"); } var data = response.Content.ReadAsStringAsync().Result; serviceResult = JsonConvert.DeserializeObject <ServiceResult <VolunteerSuggestionDTO> >(data); if (serviceResult.ServiceResultType != EnumServiceResultType.Success) { throw new Exception(serviceResult.ErrorMessage); } VolunteerSuggestionPopup.Modal = true; VolunteerSuggestionPopup.VisibleOnPageLoad = true; VolunteerFullName.Text = serviceResult.Result.VolunteerFullName; CurrentActivityName.Text = serviceResult.Result.CurrentActivityName; ApprovedCityMatchPercentage.Value = serviceResult.Result.ApprovedCityMatchPercentage; OverallCityMatchPercentage.Value = serviceResult.Result.OverallCityMatchPercentage; ApprovedRegionMatchPercentage.Value = serviceResult.Result.ApprovedRegionMatchPercentage; OverallRegionMatchPercentage.Value = serviceResult.Result.OverallRegionMatchPercentage; ApprovedSchoolTypeMatchPercentage.Value = serviceResult.Result.ApprovedSchoolTypeMatchPercentage; OverallSchoolTypeMatchPercentage.Value = serviceResult.Result.OverallSchoolTypeMatchPercentage; ApprovedNumberOfPeopleMatchTolerancePercentage.InnerText = serviceResult.Result.ApprovedNumberOfPeopleMatchTolerancePercentage.ToString("#.##"); OverallNumberOfPeopleMatchTolerancePercentage.InnerText = serviceResult.Result.OverallNumberOfPeopleMatchTolerancePercentage.ToString("#.##"); ApprovedActivityCount.InnerText = serviceResult.Result.ApprovedActivityCount.ToString(); RejectedActivityCount.InnerText = serviceResult.Result.RejectedActivityCount.ToString(); OverallActivityCount.InnerText = serviceResult.Result.OverallActivityCount.ToString(); } catch (Exception ex) { } }
public IHttpActionResult GetVolunteerSuggestion(VolunteerSuggestionFilterDTO model) { if (!Request.Headers.Contains("apiKey")) { return(Unauthorized()); } string apiKey = Request.Headers.GetValues("apiKey").First(); if (!ApiHelper.CheckKey(apiKey)) { return(Unauthorized()); } try { var serviceResult = _projectService.GetVolunteerSuggestion(model); return(Ok(serviceResult)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }