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

            string message;

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

            if (project != null)
            {
                var job = _jobDefinitionService.CreateJobDefinition(project.Id, new CreateJobDefinitionDto
                {
                    Name       = Name,
                    IsDeletion = IsDeletion
                }).Result;

                message = job.ToCliString($"Job definition has been added:", excludedFields: new string[] {
                    "ProjectId",
                    "Tasks"
                });
                Logger.LogInformation(message);
            }
            else
            {
                message = $"Project {Project} was not found";
            }

            return(message);
        }
 public IActionResult Create(JobDefinitionModel model)
 {
     if (ModelState.IsValid)
     {
         model.UserProfileId = User.Identity.GetUserProfileId() ?? default(long);
         var response = _jobDefinitionService.CreateJobDefinition(model);
         return Json(response);
     }
     else
     {
         var response = new Response<NoValue>
         {
             Status = StatusEnum.Error,
             Message = Message.SomethingWentWrong
         };
         return Json(response);
     }
 }