public IActionResult CheckCommits(GitHubInformationForm form, RequestTypes request) { var commintsNumber = 10; IList <Commit> commits = new List <Commit>(); var url = string.Empty; if (!string.IsNullOrEmpty(form.UserName) && !string.IsNullOrEmpty(form.RepositoryName)) { var gihubSettings = new GitHubSettings { UserName = form.UserName, RepositoryName = form.RepositoryName, RequestType = request }; url = _urlGenerator.GenerateUrlForGitHubApi(gihubSettings); try { commits = _githubService.ProcessCommits(url); if (commits.Any()) { commits = commits.OrderByDescending(c => c.PurpleCommit.Committer.DateOfCommit).Take(commintsNumber).ToList(); } } catch (Exception ex) { ViewBag.InnerException = ex.Message; } } return(PartialView("_Commits", commits)); }
public IActionResult CheckBranches(GitHubInformationForm form, RequestTypes request) { IList <Branch> branches = new List <Branch>(); var url = string.Empty; if (!string.IsNullOrEmpty(form.UserName) && !string.IsNullOrEmpty(form.RepositoryName)) { var gihubSettings = new GitHubSettings { UserName = form.UserName, RepositoryName = form.RepositoryName, RequestType = request }; url = _urlGenerator.GenerateUrlForGitHubApi(gihubSettings); try { branches = _githubService.ProcessBranches(url); } catch (Exception ex) { ViewBag.InnerException = ex.Message; } } return(PartialView("_Branches", branches)); }
public IActionResult CheckRepository(GitHubInformationForm form, RequestTypes request) { Repository repositoryInformation = null; var url = string.Empty; if (!string.IsNullOrEmpty(form.UserName) && !string.IsNullOrEmpty(form.RepositoryName)) { var gihubSettings = new GitHubSettings { UserName = form.UserName, RepositoryName = form.RepositoryName, RequestType = request }; url = _urlGenerator.GenerateUrlForGitHubApi(gihubSettings); try { repositoryInformation = _githubService.ProcessRepositoryInfoByUrl(url); } catch (Exception ex) { ViewBag.InnerException = ex.Message; } } return(PartialView("_Repository", repositoryInformation)); }