Atomia.Web.Frame.Controllers.HomeController.GetAvailableCountries C# (CSharp) Метод

GetAvailableCountries() приватный Метод

Gets the available countries.
private GetAvailableCountries ( ) : List
Результат List
        private List<LocaleModel> GetAvailableCountries()
        {
            List<LocaleModel> result = new List<LocaleModel>();
            string cookieCountryCode = String.Empty;

            try
            {
                // Check if there is locale settings in cookie ad set if there is
                if (this.Request != null && this.Request.Cookies != null && this.Request.Cookies["AtomiaCookieCollection"] != null && !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Cookies["AtomiaCookieCollection"].Value))
                {
                    JavaScriptSerializer js = new JavaScriptSerializer();

                    AtomiaCookieCollection cookieCollection = js.Deserialize<AtomiaCookieCollection>(System.Web.HttpContext.Current.Request.Cookies["AtomiaCookieCollection"].Value);

                    AtomiaCookie localeCookie = cookieCollection.GetAtomiaCookie(
                        "OrderLocaleCookie",
                        System.Web.HttpContext.Current.Request.ApplicationPath,
                        System.Web.HttpContext.Current.Request.Url.Host);

                    if (localeCookie != null && !String.IsNullOrEmpty(localeCookie.CookieValue))
                    {
                        cookieCountryCode = localeCookie.CookieValue;
                    }
                }

                PublicOrderConfigurationSection pocs = Atomia.Web.Plugin.PublicOrder.Helpers.LocalConfigurationHelper.GetLocalConfigurationSection();
                foreach (CountryItem country in pocs.CountriesList)
                {
                    string image = String.Empty;
                    if (!String.IsNullOrEmpty(country.Image))
                    {
                        image = country.Image;
                    }

                    result.Add(new LocaleModel { Code = country.Code, Image = image, IsDefault = String.IsNullOrEmpty(cookieCountryCode) ? country.Default : country.Code == cookieCountryCode });
                }
            }
            catch (Exception ex)
            {
                OrderPageLogger.LogOrderPageException(ex);
                throw;
            }

            return result;
        }