Exemplo n.º 1
0
        /// <summary>
        /// The Remove
        /// </summary>
        /// <param name="job">The job<see cref="JenkinsJob"/></param>
        /// <param name="failIfNotExists">The failIfNotExists<see cref="bool"/></param>
        /// <returns>The <see cref="bool"/></returns>
        public bool Remove(JenkinsJob job, bool failIfNotExists = false)
        {
            if (this.Contains(job))
            {
                try
                {
                    this.JenkinsConnection.Post(string.Format("/view/{0}/removeJobFromView?name={1}", this.Name, job.Name), string.Empty, string.Empty);
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }

            return(!failIfNotExists);
        }
Exemplo n.º 2
0
        /// <summary>
        /// The Add
        /// </summary>
        /// <param name="job">The job<see cref="JenkinsJob"/></param>
        /// <param name="failIfExists">The failIfExists<see cref="bool"/></param>
        /// <returns>The <see cref="bool"/></returns>
        public bool Add(JenkinsJob job, bool failIfExists = false)
        {
            if (!this.Contains(job))
            {
                try
                {
                    this.JenkinsConnection.Post(string.Format("/view/{0}/addJobToView?name={1}", this.Name, job.Name), string.Empty, string.Empty);
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }

            return(!failIfExists);
        }
Exemplo n.º 3
0
 /// <summary>
 /// The Contains
 /// </summary>
 /// <param name="job">The job<see cref="JenkinsJob"/></param>
 /// <returns>The <see cref="bool"/></returns>
 public bool Contains(JenkinsJob job)
 {
     return(this.Jobs().Contains(job));
 }