Пример #1
0
        public ApiController(AppService appService, ConfigurationService configurationService)
            : base(ApiRoot)
        {
            _appService = appService;
            _configurationService = configurationService;

            Get["/apps"] = x =>
                {
                    var apps = _appService.InitedApps();
                    var installPath = _configurationService.DeploymentPath();
                    return Response.AsJson(new { installPath, total = apps.Count, apps });
                };

            Get["/apps/{AppName}"] = x =>
                {
                    var appName = (string) x.AppName;
                    var backupVersions = _appService.AvailableBackupVersions(appName);
                    var version = _appService.InstalledVersion(appName);
                    return Response.AsJson(new {appName, version, backupVersions});
                };

            Post["/install-queue/{AppName}"] = x =>
                {
                    _appService.InstallPackage((string)x.AppName);
                    var response = new {next = ApiRoot + "/apps/" + x.AppName};
                    return Response.AsJson(response, HttpStatusCode.Created);
                };
        }
Пример #2
0
 private AppService(ConfigurationService cfgService, IFileSystem fs)
 {
     _cfgService = cfgService;
     _fs = fs;
 }
Пример #3
0
 public AppService(ConfigurationService cfgService)
     : this(cfgService, new FileSystem())
 {
 }
Пример #4
0
 private AppService(ConfigurationService cfgService, IFileSystem fs)
 {
     _cfgService = cfgService;
     _fs         = fs;
 }
Пример #5
0
 public AppService(ConfigurationService cfgService)
     : this(cfgService, new FileSystem())
 {
 }