public async Task <IActionResult> Integration(IntegrationView result) { if (!ModelState.IsValid) { return(View(result)); } var integrationSettings = await _settingsService.GetIntegrationSettingsById(result.Id); await _settingsService.SetIntegrationSettings(SettingsHelpers.MergeViewWithModelIntegration(integrationSettings, result)); return(RedirectToAction("Integration", "Settings")); }
public static IntegrationView ConvertToViewIntegration(IntegrationModel result) { var integrationView = new IntegrationView { Id = result.Id, Tawkto = result.Tawkto, GoogleAnalytics = result.GoogleAnalytics, FacebookPixel = result.FacebookPixel, YandexMetrica = result.YandexMetrica, GoogleMaps = result.GoogleMaps, Recaptcha = result.Recaptcha, Hotjar = result.Hotjar, CustomHeaderScripts = result.CustomHeaderScripts, CustomFooterScripts = result.CustomFooterScripts }; return(integrationView); }
public static IntegrationModel MergeViewWithModelIntegration(IntegrationModel model, IntegrationView view) { model.Tawkto = view.Tawkto; model.GoogleAnalytics = view.GoogleAnalytics; model.FacebookPixel = view.FacebookPixel; model.YandexMetrica = view.YandexMetrica; model.GoogleMaps = view.GoogleMaps; model.Recaptcha = view.Recaptcha; model.Hotjar = view.Hotjar; model.CustomHeaderScripts = view.CustomHeaderScripts; model.CustomFooterScripts = view.CustomFooterScripts; return(model); }