ALMRestClient.ALMClient.UpdateDefect C# (CSharp) Method

UpdateDefect() public method

Update an ALM item
public UpdateDefect ( string id, ALMItem changes ) : bool
id string Id of the item
changes ALMItem An item containing all the fields to change
return bool
        public bool UpdateDefect(string id, ALMItem changes)
        {
            var req = new RestRequest(clientConfig.LockEntityAddress);
            AddDomainAndProject(req);
            AddDefectAndId(id, req);

            IRestResponse response = null;

            try
            {
                response = Execute(req, "update defect -> lock item");

                if (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Created)
                {
                    if (Update(id, changes) == false && HideCustomExceptions == false)
                    {
                        // Todo: Determine what exception should be thrown
                    }
                }
            }
            finally
            {
                // then delete the lock
                req.Method = Method.DELETE;
                response = Execute(req, "update defect -> unlock item");
            }

            // Delete lock was successful
            return response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Accepted || response.StatusCode == HttpStatusCode.NoContent;
        }