public async Task <IActionResult> GeneralCommon( GeneralCommonSettingsModel model, int storeScope, StoreInformationSettings storeInformationSettings, SeoSettings seoSettings, DateTimeSettings dateTimeSettings, SecuritySettings securitySettings, CaptchaSettings captchaSettings, PdfSettings pdfSettings, LocalizationSettings localizationSettings, CompanyInformationSettings companySettings, ContactDataSettings contactDataSettings, BankConnectionSettings bankConnectionSettings, SocialSettings socialSettings, HomePageSettings homePageSeoSettings) { if (!ModelState.IsValid) { await PrepareConfigurationModelAsync(model); return(View(model)); } ModelState.Clear(); // Necessary before mapping var resetUserSeoCharacterTable = seoSettings.SeoNameCharConversion != model.SeoSettings.SeoNameCharConversion; var clearSeoFriendlyUrls = localizationSettings.SeoFriendlyUrlsForLanguagesEnabled != model.LocalizationSettings.SeoFriendlyUrlsForLanguagesEnabled; var prevPdfLogoId = pdfSettings.LogoPictureId; // Map model to entities MiniMapper.Map(model.StoreInformationSettings, storeInformationSettings); MiniMapper.Map(model.SeoSettings, seoSettings); MiniMapper.Map(model.DateTimeSettings, dateTimeSettings); MiniMapper.Map(model.SecuritySettings, securitySettings); MiniMapper.Map(model.CaptchaSettings, captchaSettings); MiniMapper.Map(model.PdfSettings, pdfSettings); MiniMapper.Map(model.LocalizationSettings, localizationSettings); MiniMapper.Map(model.CompanyInformationSettings, companySettings); MiniMapper.Map(model.ContactDataSettings, contactDataSettings); MiniMapper.Map(model.BankConnectionSettings, bankConnectionSettings); MiniMapper.Map(model.SocialSettings, socialSettings); MiniMapper.Map(model.HomepageSettings, homePageSeoSettings); #region POST mapping // Set CountryId explicitly else it can't be resetted. companySettings.CountryId = model.CompanyInformationSettings.CountryId ?? 0; //// (Un)track PDF logo id await _mediaTracker.Value.TrackAsync(pdfSettings, prevPdfLogoId, x => x.LogoPictureId); seoSettings.MetaTitle = model.SeoSettings.MetaTitle; seoSettings.MetaDescription = model.SeoSettings.MetaDescription; seoSettings.MetaKeywords = model.SeoSettings.MetaKeywords; foreach (var localized in model.SeoSettings.Locales) { await _localizedEntityService.ApplyLocalizedSettingAsync(seoSettings, x => x.MetaTitle, localized.MetaTitle, localized.LanguageId, storeScope); await _localizedEntityService.ApplyLocalizedSettingAsync(seoSettings, x => x.MetaDescription, localized.MetaDescription, localized.LanguageId, storeScope); await _localizedEntityService.ApplyLocalizedSettingAsync(seoSettings, x => x.MetaKeywords, localized.MetaKeywords, localized.LanguageId, storeScope); } homePageSeoSettings.MetaTitle = model.HomepageSettings.MetaTitle; homePageSeoSettings.MetaDescription = model.HomepageSettings.MetaDescription; homePageSeoSettings.MetaKeywords = model.HomepageSettings.MetaKeywords; foreach (var localized in model.HomepageSettings.Locales) { await _localizedEntityService.ApplyLocalizedSettingAsync(homePageSeoSettings, x => x.MetaTitle, localized.MetaTitle, localized.LanguageId, storeScope); await _localizedEntityService.ApplyLocalizedSettingAsync(homePageSeoSettings, x => x.MetaDescription, localized.MetaDescription, localized.LanguageId, storeScope); await _localizedEntityService.ApplyLocalizedSettingAsync(homePageSeoSettings, x => x.MetaKeywords, localized.MetaKeywords, localized.LanguageId, storeScope); } await _db.SaveChangesAsync(); if (resetUserSeoCharacterTable) { SeoHelper.ResetUserSeoCharacterTable(); } // TODO: (mh) (core) Do this right, if still needed. //if (clearSeoFriendlyUrls) //{ // LocalizedRoute.ClearSeoFriendlyUrlsCachedValue(); //} #endregion // Does not contain any store specific settings. await Services.SettingFactory.SaveSettingsAsync(securitySettings); return(NotifyAndRedirect("GeneralCommon")); }