Пример #1
0
        private async Task <bool> ValidateCredentialsTask(string username, string password)
        {
            try
            {
                var validationRequest = new ValidationRequestDto
                {
                    Email    = username,
                    Password = password
                };
                var url      = string.Format("{0}account/validate", _endPoint);
                var response = _httpClient.PostAsJsonAsync(url, validationRequest);
                response.Result.EnsureSuccessStatusCode();
                var content = await response.Result.Content.ReadAsStringAsync();

                var result = JsonHelper.Deserialize <ValidationResponseDto>(content);

                return(result.IsValid);
            }
            catch (Exception ex)
            {
                _loggingService.Log(string.Format("Error validating JustGiving account: {0}", ex.Message),
                                    LogLevel.Error);
            }

            return(false);
        }
        private async Task<bool> ValidateCredentialsTask(string username, string password)
        {
            try
            {
                var validationRequest = new ValidationRequestDto
                {
                    Email = username,
                    Password = password
                };
                var url = string.Format("{0}account/validate", _endPoint);
                var response = _httpClient.PostAsJsonAsync(url, validationRequest);
                response.Result.EnsureSuccessStatusCode();
                var content = await response.Result.Content.ReadAsStringAsync();
                var result = JsonHelper.Deserialize<ValidationResponseDto>(content);

                return result.IsValid;
            }
            catch (Exception ex)
            {
                _loggingService.Log(string.Format("Error validating JustGiving account: {0}", ex.Message),
                    LogLevel.Error);
            }

            return false;
        }