Exemple #1
0
 public List <WorkItem> GetAllWorkItems()
 {
     try
     {
         var workItems = _workItemRepository.GetAll();
         return(workItems);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            using (var workItemRepo = new WorkItemRepository())
            {
                const string c_collectionUri = "https://fabrikam.visualstudio.com/DefaultCollection";
                const string c_projectName   = "MyGreatProject";
                const string c_repoName      = "MyRepo";

                // Interactively ask the user for credentials, caching them so the user isn't constantly prompted
                VssCredentials creds = new VssClientCredentials();
                creds.Storage = new VssClientCredentialStorage();

                // Connect to VSTS
                VssConnection connection = new VssConnection(new Uri(c_collectionUri), creds);

                // Get a GitHttpClient to talk to the Git endpoints
                GitHttpClient gitClient = connection.GetClient <GitHttpClient>();

                // Get data about a specific repository
                var repo = gitClient.GetRepositoryAsync(c_projectName, c_repoName).Result;

                var a = workItemRepo.GetAll().ToList();
            }
        }
        public IHttpActionResult GetAll([FromUri] Pagination pagination)
        {
            pagination = pagination ?? new Pagination();

            var results = repo.GetAll();
            var total   = results.Count();

            if (pagination.HasOffset)
            {
                results = results.Skip(pagination.Offset.Value);
            }
            results = results.Take(pagination.Limit);

            var result = new PagedResults <WorkItem>()
            {
                Limit   = pagination.Limit,
                Count   = results.Count(),
                Offset  = pagination.Offset.GetValueOrDefault(),
                Total   = total,
                Results = results,
            };

            return(Ok(result));
        }
 public List <WorkItem> GetAll()
 {
     return(workItemRepository.GetAll());
 }