async Task InvokePOST(IOwinContext context, CancellationToken cancellationToken) { IRegistrationOwnership registrationOwnership = CreateRegistrationOwnership(); ICategorizationPermission categorizationPermission = CategorizationPermission(); switch (context.Request.Path.Value) { case "/apiapp/checkaccess": { CheckAccessImpl uploader = new CheckAccessImpl(registrationOwnership); await uploader.CheckAccess(context); break; } case "/apiapp/upload": { PublishImpl uploader = new ApiAppsPublishImpl(registrationOwnership, categorizationPermission, _imagesUri); await uploader.Upload(context, cancellationToken); break; } case "/apiapp/edit": { PublishImpl uploader = new ApiAppsPublishImpl(registrationOwnership, categorizationPermission, _imagesUri); await uploader.Edit(context, cancellationToken); break; } case "/delete": { DeleteImpl deleteImpl = new DeleteImpl(registrationOwnership); await deleteImpl.Delete(context, cancellationToken); break; } case "/tenant/enable": { PublishImpl uploader = new ApiAppsPublishImpl(registrationOwnership); await uploader.TenantEnable(context); break; } case "/tenant/disable": { PublishImpl uploader = new ApiAppsPublishImpl(registrationOwnership); await uploader.TenantDisable(context); break; } case "/agreements/accept": { AgreementImpl agreement = new AgreementImpl(registrationOwnership); await agreement.AcceptAgreement(context); break; } case "/catalog/powershell": { PublishImpl uploader = new PowerShellPublishImpl(registrationOwnership); await uploader.Upload(context, cancellationToken); break; } default: { await context.Response.WriteAsync("NotFound"); context.Response.StatusCode = (int)HttpStatusCode.NotFound; break; } } }
async Task InvokeGET(IOwinContext context) { IRegistrationOwnership registrationOwnership = CreateRegistrationOwnership(); switch (context.Request.Path.Value) { case "/": { await context.Response.WriteAsync("READY."); context.Response.StatusCode = (int)HttpStatusCode.OK; break; } case "/domains": { PublishImpl uploader = new ApiAppsPublishImpl(registrationOwnership); await uploader.GetDomains(context); break; } case "/tenants": { PublishImpl uploader = new ApiAppsPublishImpl(registrationOwnership); await uploader.GetTenants(context); break; } case "/agreements": { AgreementImpl agreement = new AgreementImpl(registrationOwnership); await agreement.GetAgreementAcceptance(context); break; } default: { await context.Response.WriteAsync("NotFound"); context.Response.StatusCode = (int)HttpStatusCode.NotFound; break; } } }