/// <summary>
        /// Creates a new instance of <see cref="LanguageSelectorViewModel"/>.
        /// </summary>
        /// <param name="currentCulture">The current culture.</param>
        /// <param name="availableCultures">The available cultures.</param>
        /// <returns>An instance of <see cref="LanguageSelectorViewModel"/>.</returns>
        public static LanguageSelectorViewModel Create(string currentCulture, IEnumerable<string> availableCultures)
        {
            var model = new LanguageSelectorViewModel();

            model.CurrentCultureName = currentCulture;
            model.AvailableCultures =
                availableCultures.Select(
                    c => new SelectListItem { Value = c, Text = c });

            return model;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new instance of <see cref="LanguageSelectorViewModel"/>.
        /// </summary>
        /// <param name="currentCulture">The current culture.</param>
        /// <param name="availableCultures">The available cultures.</param>
        /// <returns>An instance of <see cref="LanguageSelectorViewModel"/>.</returns>
        public static LanguageSelectorViewModel Create(string currentCulture, IEnumerable <string> availableCultures)
        {
            var model = new LanguageSelectorViewModel();

            model.CurrentCultureName = currentCulture;
            model.AvailableCultures  =
                availableCultures.Select(
                    c => new SelectListItem {
                Value = c, Text = c
            });

            return(model);
        }