Esempio n. 1
0
        public ActionResult List(string application)
        {
            Persistence.Application app   = this._repository.GetApplication(application);
            PackageListModel        model = new PackageListModel {
                Packages = this._repository.GetPackages(app), Application = application
            };

            return(this.View("List", model));
        }
Esempio n. 2
0
 public ActionResult AddSubmit(PackageAddModel model)
 {
     if (model.File != null && model.File.ContentLength > 0)
     {
         Logger.Info(this, "Received package upload " + model.File.FileName);
         Core.Package            package = BytePackage.Create(model.File.InputStream.ReadAllBytes(), model.File.FileName);
         Persistence.Application fileSystemApplication = this._repository.GetApplication(model.Application);
         this._repository.CreatePackage(fileSystemApplication, package);
     }
     return(this.RedirectToAction("List", new { application = model.Application }));
 }
Esempio n. 3
0
        public HttpResponseMessage GetBytes(string name, [ModelBinder(typeof(VersionModelBinder))] Version version)
        {
            Persistence.Application fileSystemApplication = this._packageRepository.GetApplication(name);
            Persistence.Package     package  = this._packageRepository.GetPackage(fileSystemApplication, version);
            HttpResponseMessage     response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StreamContent(this._packageRepository.GetPackage(package))
            };

            response.Content.Headers.ContentDisposition          = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
            response.Content.Headers.ContentDisposition.FileName = Path.GetFileName(package.File);
            return(response);
        }
Esempio n. 4
0
 public Package GetPackage(string name, [ModelBinder(typeof(VersionModelBinder))] Version version)
 {
     Persistence.Application fileSystemApplication = this._packageRepository.GetApplication(name);
     return(Mapper.Map <Package>(this._packageRepository.GetPackage(fileSystemApplication, version)));
 }
Esempio n. 5
0
 public IEnumerable <Package> GetPackages(string name, [ModelBinder(typeof(VersionModelBinder))] Version since = null)
 {
     Persistence.Application fileSystemApplication = this._packageRepository.GetApplication(name);
     return(this._packageRepository.GetPackages(fileSystemApplication, since).Select(Mapper.Map <Package>));
 }