Пример #1
0
        /// <summary>
        /// GetResultGoogle
        /// </summary>
        /// <param name="keyWord"></param>
        /// <returns></returns>
        public async Task <GoogleDto> GetResultGoogle(string keyWord)
        {
            var result             = new GoogleDto();
            var resultGoogleSearch = await _googleRepository.Search(keyWord);

            if (resultGoogleSearch != null)
            {
                result.SearchEngine = EnumEngine.Google.ToString();
                result.Total        = resultGoogleSearch.searchInformation.totalResults;
            }

            return(result);
        }
Пример #2
0
        public IActionResult FacebookPost([FromBody] GoogleDto googledto)
        {
            var user = _mapper.Map <UserDetails>(googledto);

            user.Username  = googledto.Name;
            user.FirstName = googledto.Name;
            user.LastName  = googledto.Name;
            user.PhotoUrl  = "dummy-dp";
            var fbuser = _userService.Create(user);

            return(Ok(new {
                Id = fbuser.UserId,
                Username = fbuser.Username,
                Email = fbuser.Email,
                FirstName = fbuser.FirstName,
                LastName = fbuser.LastName
            }));
        }
Пример #3
0
        public async Task <string> ValidateUser([FromBody] GoogleDto googleDto)
        {
            //Microservice request
            var client = new HttpClient();

            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            try
            {
                AppConfig api        = new AppConfig();
                var       stringTask = await client.PostAsync(api.googleurl + "api/Google", new StringContent(JsonConvert.SerializeObject(googleDto), Encoding.UTF8, "application/json"));

                var msg = stringTask.Content.ReadAsStringAsync().Result;
                return(msg);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(null);
        }