Exemplo n.º 1
0
        public ActionResult ExportXml(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageLanguages))
            {
                return(AccessDeniedView());
            }

            var language = _languageService.GetLanguageById(id);

            if (language == null)
            {
                //No language found with the specified id
                return(RedirectToAction("List"));
            }

            try
            {
                var fileName = string.Format("language_{0}.xml", id);
                var xml      = _exportManager.ExportLanguageToXml(language);
                return(new XmlDownloadResult(xml, fileName));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc);
                return(RedirectToAction("List"));
            }
        }