예제 #1
0
        public async Task <ActionResult> LocalizeConfig_Partial(Model model)
        {
            using (LocalizeConfigDataProvider dataProvider = new LocalizeConfigDataProvider()) {
                LocalizeConfigData origData = YetaWF.Core.Audit.Auditing.Active ? await dataProvider.GetItemAsync() : null;

                LocalizeConfigData data = await dataProvider.GetItemAsync();// get the original item

                if (!ModelState.IsValid)
                {
                    return(PartialView(model));
                }
                data = model.GetData(data); // merge new data into original
                model.SetData(data);        // and all the data back into model for final display

                LocalizationSupport locSupport = new LocalizationSupport();
                await locSupport.SetUseLocalizationResourcesAsync(model.UseLocalizationResources);

                await locSupport.SetAbortOnFailureAsync(model.AbortOnFailure);

                await dataProvider.UpdateConfigAsync(data);

                await Auditing.AddAuditAsync($"{nameof(LocalizeConfigModuleController)}.{nameof(LocalizeConfig)}", null, Guid.Empty, $"Localization",
                                             DataBefore : origData,
                                             DataAfter : data,
                                             RequiresRestart : true
                                             );
            }
            return(FormProcessed(model, this.__ResStr("okSaved", "Localization settings saved - These settings won't take effect until the site is restarted")));
        }