Ejemplo n.º 1
0
        public List <Country> GetWebCountries()
        {
            var service = new CountryWebService();

            return(service.Countries);
            //  return null;
        }
        public IActionResult About()
        {
            ViewData["Message"] = "Your application description page.";

            CountryWebService info = new CountryWebService();

            string des = info.ObtenerCountry();

            ViewBag.info = des;

            return(View());
        }
Ejemplo n.º 3
0
        public static async Task SynchronizeCountriesAsync()
        {
            try
            {
                //Synchronize Countries
                var countryList = await CountryWebService.FindCountriesAsync();

                if (countryList != null)
                {
                    var dbContext      = Resolver.Resolve <ISQLite>().GetConnection();
                    var countryService = new CountryService(dbContext);
                    countryService.UpdateCountryList(countryList);
                }
            }
            catch (Exception except)
            {
                ILogger.Instance.Error("Unable to synchronize countries", except);
            }
        }
Ejemplo n.º 4
0
        private async Task <bool> PreLoadDataAsync()
        {
            bool result = false;

            try
            {
                var countryService = new CountryService(_dbContext);
                _countries = countryService.FindCountries();
                if (_countries == null || _countries.Count == 0)
                {
                    //find country in server if not present in database (this viewModel can be display directly after user login)
                    _countries = await CountryWebService.FindCountriesAsync();

                    //populate country in local database
                    if (_countries != null && _countries.Count > 0)
                    {
                        countryService.UpdateCountryList(_countries);
                    }
                }

                var userInfoKey = new UserInfoKey()
                {
                    UserId = _userId
                };
                _userInfo = await UserInfoWebService.GetUserInfoAsync(userInfoKey);

                if (_userInfo != null && _countries != null && _countries.Count > 0)
                {
                    result = true;
                }
            }
            catch
            {
            }
            return(result);
        }