Ejemplo n.º 1
0
        public FileResult PackDictionary(int ID, string[] filePath)
        {
            var dataDictionary = ServiceLocator.Current.GetInstance <IDataDictionaryService>().Get(ID);
            var installer      = new DataDictionaryPackageInstaller();

            if (filePath != null && filePath.Any())
            {
                installer.OnPacking = () =>
                {
                    List <System.IO.FileInfo> files = new List <System.IO.FileInfo>();
                    foreach (var item in filePath)
                    {
                        files.Add(new System.IO.FileInfo(Server.MapPath(item)));
                    }
                    return(files);
                };
            }

            return(File(installer.Pack(dataDictionary).ToFilePackage(), "Application/zip", dataDictionary.Title + ".widget"));
        }
Ejemplo n.º 2
0
        public FileResult PackDictionary(int ID, string[] filePath)
        {
            var dataDictionaryService = HttpContext.RequestServices.GetService <IDataDictionaryService>();
            var dataDictionary        = dataDictionaryService.Get(ID);
            var installer             = new DataDictionaryPackageInstaller(HttpContext.RequestServices.GetService <IWebHostEnvironment>(), dataDictionaryService);

            if (filePath != null && filePath.Any())
            {
                installer.OnPacking = () =>
                {
                    List <System.IO.FileInfo> files = new List <System.IO.FileInfo>();
                    foreach (var item in filePath)
                    {
                        files.Add(new System.IO.FileInfo(Request.MapPath(item)));
                    }
                    return(files);
                };
            }

            return(File(installer.Pack(dataDictionary).ToFilePackage(), "Application/zip", dataDictionary.Title + ".widget"));
        }