public async Task <IActionResult> GetLookupConfigByName(int lId, string status, string lName)
 {
     try
     {
         return(Ok(await lookupRepo.GetLookupConfigByName(lId, status, lName)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
Beispiel #2
0
        public async Task <IActionResult> GetWorkItem(int id)
        {
            var uriLookup = await lookupRepo.GetLookupConfigByName(0, "Y", "DevOps_Uri");

            Uri accountUri = new Uri(uriLookup.Lvalue); //new Uri("https://dev.azure.com/inser13");

            var tokenLookup = await lookupRepo.GetLookupConfigByName(0, "Y", "DevOps_AccessToken");

            String personalAccessToken = tokenLookup.Lvalue; //"4b6dsojsubb7bzkowrm6krz5f7gjubfirckbvu5kn5nzmwdljkyq";  // See https://www.visualstudio.com/docs/integrate/get-started/authentication/pats

            // Create a connection to the account
            VssConnection connection = new VssConnection(accountUri, new VssBasicCredential(string.Empty, personalAccessToken));

            // Get an instance of the work item tracking client
            WorkItemTrackingHttpClient witClient = connection.GetClient <WorkItemTrackingHttpClient>();

            try
            {
                // Get the specified work item
                WorkItem workitem = witClient.GetWorkItemAsync(id).Result;

                return(Ok(workitem));
            }
            catch (AggregateException aex)
            {
                VssServiceException vssex = aex.InnerException as VssServiceException;
                if (vssex != null)
                {
                    throw vssex;
                }
                throw aex;
            }
        }