Exemplo n.º 1
0
        public FileResult DownloadVariant(Guid?systemid)
        {
            var    symbolFiles  = _symbolService.GetSymbolVariant(systemid.Value);
            string targetFolder = System.Web.HttpContext.Current.Server.MapPath("~/files/");

            if (!string.IsNullOrEmpty(symbolFiles[0].Symbol.SymbolPackages.FirstOrDefault()?.Folder))
            {
                targetFolder = targetFolder + "\\" + symbolFiles[0].Symbol.SymbolPackages.FirstOrDefault()?.Folder + "\\";
            }

            using (ZipFile zip = new ZipFile())
            {
                foreach (var file in symbolFiles)
                {
                    zip.AddFile(targetFolder + file.FileName, "");
                }
                MemoryStream output = new MemoryStream();
                zip.Save(output);
                output.Position = 0;

                return(File(output, "application/zip", ImageService.MakeSeoFriendlyString(symbolFiles[0].SymbolFileVariant.Name) + ".zip"));
            }
        }
Exemplo n.º 2
0
        // GET: SymbolFiles/Edit/5
        public ActionResult Edit(Guid?systemid)
        {
            if (systemid == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ViewBag.Size           = new SelectList(CodeList.Size, "Key", "Value");
            ViewBag.SymbolGraphics = new SelectList(CodeList.SymbolGraphics, "Key", "Value");

            List <SymbolFile> symbolFiles = _symbolService.GetSymbolVariant(systemid.Value);

            if (symbolFiles == null)
            {
                return(HttpNotFound());
            }
            return(View(symbolFiles));
        }