Пример #1
0
        public override Task <HttpHandlerResult> GetAsync(CancellationToken token)
        {
            var vm = new BuildNewVM {
                ProjectId        = GetQuery("project"),
                TaskName         = GetQuery("task"),
                TaskRoles        = GetQuery("roles"),
                PreBuildCommand  = GetQuery("prebuild"),
                AssemblyFilename = GetQuery("assembly"),
            };

            var qRefspec = GetQuery("refspec");

            if (!string.IsNullOrEmpty(qRefspec))
            {
                vm.GitRefspec = qRefspec;
            }

            try {
                vm.Build();
            }
            catch (Exception error) {
                vm.Errors.Add(error);
            }

            return(Response.View("Build\\New.html", vm).AsAsync());
        }
Пример #2
0
        public override async Task <HttpHandlerResult> PostAsync(CancellationToken token)
        {
            var vm = new BuildNewVM(this);

            try {
                vm.Restore(Request.FormData());
                await vm.StartBuild();

                // TODO: Add support for url fragments to PiServerLite
                // TODO: Then nav to #output
                return(Response.Redirect("build/details", new {
                    project = vm.ProjectId,
                    number = vm.BuildNumber,
                }));
            }
            catch (Exception error) {
                vm.Errors.Add(error);

                vm.Build();

                return(Response.View("Build\\New.html", vm));
            }
        }