Example #1
0
        public ActionResult Export(int id, string fileName)
        {
            var site = FindSite(id);

            try
            {
                if (ModelState.IsValid)
                {
                    var siteService = new SiteService(DataContext);
                    var xml         = siteService.Export(site, fileName);

                    Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName);
                    Response.Write(xml);
                    Response.End();

                    // ShowSuccess(MessageResource.ExportSuccess);
                }
            }
            catch (Exception ex)
            {
                LogError(ex.ToString());
                ShowError(MessageResource.ExportFailed);
            }

            return(View(site));
        }
Example #2
0
        public ActionResult Export(int id, string fileName)
        {
            var site = FindSite(id);
            try
            {
                if (ModelState.IsValid)
                {
                    var siteService = new SiteService(DataContext);
                    var xml = siteService.Export(site, fileName);

                    Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName);
                    Response.Write(xml);
                    Response.End();

                   // ShowSuccess(MessageResource.ExportSuccess);
                }
            }
            catch (Exception ex)
            {
                LogError(ex.ToString());
                ShowError(MessageResource.ExportFailed);
            }

            return View(site);
        }