// GET: Top 1000 badge public async Task <ActionResult> GetTop1000Badge() { Response.ContentType = "image/svg+xml"; var req = System.Web.HttpContext.Current.Request; var bqd = new BadgeQueryData(req); var c = await GitHubHelper.GetClient(); //var repoData = await GitHubHelper.GetRepoData(bqd.User, bqd.Repo); var repoData = await c.GetRepoData(bqd); Debug.Write("GOOOOO!!!!!!!!!!"); foreach (var l in Languages.All) { Debug.WriteLine("l: " + l.Name); var repos = c.Search.SearchRepo(new SearchRepositoriesRequest { Language = l.OctokitLanguage, Order = SortDirection.Descending, SortField = RepoSearchSort.Stars, PerPage = 100, Page = 1 }).Result.Items; Debug.WriteLine("repo: " + repos.FirstOrDefault()?.FullName); } var top1000 = await DataGetter.GetTop1000(repoData.Lang.ApiName); var place = top1000?.Repos?.FirstOrDefault(r => r.UserName.Equals(repoData.UserName) && r.RepoName.Equals(repoData.RepoName))?.Place ?? 0; var badge = new Top1000Badge(bqd, place.ToString(), repoData.Lang); var viewModel = new Top1000BadgeViewModel(badge); return(View("Top1000Badge", viewModel)); }
public Top1000BadgeViewModel(Top1000Badge badge) { Badge = badge; }