Beispiel #1
0
        public ViewResult CommitImportResources(bool?previewImport, bool?showMenu, ICollection <DetectedImportChange> changes)
        {
            var model = new ImportResourcesViewModel
            {
                ShowMenu = showMenu ?? false
            };

            try
            {
                var importer = new ResourceImporter();
                var result   = importer.ImportChanges(changes.Where(c => c.Selected).ToList());

                ViewData["LocalizationProvider_ImportResult"] = string.Join("<br/>", result);
            }
            catch (Exception e)
            {
                ModelState.AddModelError("importFailed", $"Import failed! Reason: {e.Message}");
            }

            return(View("ImportResources", model));
        }