public async Task<ActionResult> Index() { using (var db = new HeroesContext()) { return View(await db.People.ToListAsync()); } }
public async Task<ActionResult> Index() { using (var db = new HeroesContext()) { var herosCount = await db.Heroes.CountAsync(); if (herosCount > 0) { return RedirectToAction("Top", "Heroes"); } return RedirectToAction("Index", "People"); } }