Exemplo n.º 1
0
        public override string Execute()
        {
            Console.WriteLine($"Trying to update job definition \"{Name}\" from project {Project}...");

            string message;

            var project = _projectService.GetProjectByName(Project).Result;

            if (project != null)
            {
                var job = _jobDefinitionService.GetJobDefinitionByName(project.Id, Name).Result;

                if (job != null)
                {
                    _jobDefinitionService.UpdateJobDefinition(project.Id, job.Id, new UpdateJobDefinitionDto
                    {
                        Id   = job.Id,
                        Name = Rename ?? job.Name
                    }).Wait();

                    message = $"Job definition {Name} has been updated successfully";
                    Logger.LogInformation(message);
                    return(message);
                }
            }

            message = $"Failed to update job definition {Name}. Make sure the project and job definition names are correct.";

            return(message);
        }
        public IActionResult Edit(JobDefinitionModel model)
        {
            if (ModelState.IsValid)
            {
                model.UserProfileId = User.Identity.GetUserProfileId() ?? default(long);
                var response = _jobDefinitionService.UpdateJobDefinition(model);

                return Json(response);
            }
            else
            {
                var response = new Response<NoValue>
                {
                    Status = StatusEnum.Error,
                    Message = Message.SomethingWentWrong
                };
                return Json(response);
            }
        }