public IActionResult Index(SuPreferenceIndexGetWithListsModel FromForm)
 {
     SqlParameter[] parameters =
     {
         new SqlParameter("@UserId",     FromForm.Preference.Id),
         new SqlParameter("@LanguageId", FromForm.Preference.DefaultLanguageId),
         new SqlParameter("@CountryId",  FromForm.Preference.CountryId)
     };
     _context.Database.ExecuteSqlCommand("PreferenceIndexPost " +
                                         "@UserId" +
                                         ", @LanguageId" +
                                         ", @CountryId", parameters);
     return(RedirectToAction("Index", "Home"));
 }
        public async Task <IActionResult> Index()
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            var DefaultLanguageID = CurrentUser.DefaultLanguageId;

            var UICustomizationArray = new UICustomization(_context);

            ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID);

            Menus a = new Menus(_context);

            ViewBag.menuItems = await a.TopMenu(DefaultLanguageID);


            var parameter = new SqlParameter("@Id", CurrentUser.Id);

            SuPreferenceIndexGetModel          preference         = _context.ZdbPreferenceIndexGet.FromSql("PreferenceIndexGet @Id", parameter).First();
            SuPreferenceIndexGetWithListsModel preferenceWithList = new SuPreferenceIndexGetWithListsModel
            {
                Preference = preference
            };
            List <SuCountryList>  countryList  = _context.ZDbCountryList.FromSql("CountrySelectAll").ToList();
            List <SuLanguageList> languageList = _context.ZDbLanguageList.FromSql("LanguageSelectActive").ToList();
            List <SelectListItem> countries    = new List <SelectListItem>();
            List <SelectListItem> languages    = new List <SelectListItem>();

            foreach (var countryitem in countryList)
            {
                countries.Add(new SelectListItem(countryitem.Name, countryitem.Id.ToString()));
            }
            preferenceWithList.Countries = countries;
            foreach (var Languageitem in languageList)
            {
                languages.Add(new SelectListItem(Languageitem.Name, Languageitem.Id.ToString()));
            }
            preferenceWithList.Languages = languages;
            return(View(preferenceWithList));
        }