Exemplo n.º 1
0
        public virtual ActionResult Delete(AssemblyFile[] model)
        {
            var entry = new JsonResultEntry();
            try
            {
                if (model != null)
                {
                    foreach (var fileName in model)
                    {
                        if (!string.IsNullOrEmpty(fileName.FileName))
                        {
                            AssemblyManager.Delete(Site, fileName.FileName);
                        }
                    }
                }
                entry.SetSuccess();
            }
            catch (Exception e)
            {
                entry.SetFailed().AddException(e);
            }
            return Json(entry);

            //return RedirectToAction("Index");
        }
Exemplo n.º 2
0
 public virtual void Delete(Site site, string fileName)
 {
     AssemblyFile assemblyFile = new AssemblyFile(site, fileName);
     if (assemblyFile.Exists())
     {
         assemblyFile.Delete();
     }
     DeleteFromBin(site, fileName);
     EnsureAssembliesExistsInBin(site);
 }
Exemplo n.º 3
0
        public virtual IEnumerable<AssemblyFile> GetFiles(Site site)
        {
            List<AssemblyFile> files = new List<AssemblyFile>();

            AssemblyFile dummy = new AssemblyFile(site, "dummy.dll");
            if (Directory.Exists(dummy.BasePhysicalPath))
            {
                foreach (var file in Directory.EnumerateFiles(dummy.BasePhysicalPath, "*.dll"))
                {
                    files.Add(new AssemblyFile(site, Path.GetFileName(file)));
                }
            }

            return files;
        }
Exemplo n.º 4
0
        public virtual ActionResult Delete(AssemblyFile[] model, string @return)
        {
            var data = new JsonResultData(ModelState);

            data.RunWithTry((resultData) =>
            {
                if (model != null)
                {
                    foreach (var fileName in model)
                    {
                        if (!string.IsNullOrEmpty(fileName.FileName))
                        {
                            AssemblyManager.Delete(Site, fileName.FileName);
                        }
                    }
                }
                resultData.RedirectUrl = @return;
            });
            return Json(data);
        }
Exemplo n.º 5
0
 public virtual void Upload(Site site, string fileName, Stream stream)
 {
     AssemblyFile assemblyFile = new AssemblyFile(site, fileName);
     //assemblyFile.
     assemblyFile.Save(stream);
     DeleteFromBin(site, fileName);
     EnsureAssembliesExistsInBin(site);
 }