/// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The Dfa user object running the code example.
        /// </param>
        public override void Run(DfaUser user)
        {
            // Create SpotlightRemoteService instance.
            SpotlightRemoteService service = (SpotlightRemoteService)user.GetService(
                DfaService.v1_19.SpotlightRemoteService);

            // Set search criteria.
            CountrySearchCriteria countrySearchCriteria = new CountrySearchCriteria();

            countrySearchCriteria.secure = false;

            try {
                // Get countries.
                Country[] countries = service.getCountriesByCriteria(countrySearchCriteria);

                // Display country names, codes and secure server support information.
                if (countries != null)
                {
                    foreach (Country result in countries)
                    {
                        Console.WriteLine("Country name \"{0}\", country code \"{1}\", supports a secure " +
                                          "server? \"{2}\".", result.name, result.id, result.secure);
                    }
                }
            } catch (Exception e) {
                Console.WriteLine("Failed to retrieve countries. Exception says \"{0}\"", e.Message);
            }
        }
Beispiel #2
0
        public List <Country> GetCountryeBySearch(CountrySearchCriteria model)
        {
            IQueryable <Country> countries = db.Countries.Where(c => c.isDelete == false).AsQueryable();

            if (!string.IsNullOrEmpty(model.Name))
            {
                countries = countries.Where(c => c.Name.ToLower().Contains(model.Name.ToLower()));
            }

            return(countries.ToList());
        }
Beispiel #3
0
        // GET: /Country/
        public ActionResult Index(CountrySearchCriteria model)
        {
            var countries = _countryManager.GetCountryeBySearch(model);

            if (countries == null)
            {
                countries = new List <Country>();
            }


            model.Countries = countries;
            return(View(model));
        }
Beispiel #4
0
        public List <Country> GetCountryeBySearch(CountrySearchCriteria model)
        {
            List <Country> countries = _countryRepository.GetCountryeBySearch(model);

            return(countries);
        }