Ejemplo n.º 1
0
        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"));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }