// GET: /<controller>/ public IActionResult Index() { foreach (GitHubRepository repo in _context.Repositories.ToList()) { _context.Remove(repo); } _context.SaveChanges(); return(RedirectToAction("Index", "Home", new { })); }
// GET: /<controller>/ public async Task <IActionResult> Index() { if (_context.Repositories.ToList().Count == 0) { // populate the data from the GitHub API foreach (GitHubRepository repo in await _githubClient.FetchRepositories("orgs/gopangea/repos")) { _context.Repositories.Add(repo); } _context.SaveChanges(); } return(RedirectToAction("Index", "Home", new { })); }