public async Task <IActionResult> Index() { var allbags = await _cache.GetFromTable(_context.Bags); var random = new Random(); int index = random.Next(allbags.Count); ViewBag.Count = allbags.Count; return(View(allbags[index])); }
public async Task <IActionResult> Index() { AllLinkViewModel alvm = new AllLinkViewModel(); alvm.Links = await _cache.GetFromTable(_context.Links); alvm.People = await _cache.GetFromTable(_context.People); alvm.Bags = await _cache.GetFromTable(_context.Bags); alvm.Links = alvm.Links.OrderByDescending(x => x.LinkNumber).Take(10).ToList(); return(View(alvm)); }
public async Task <List <Bagtypes> > GetBagtypes() { var bagtypes = await _cache.GetFromTable(_context.Types); return(bagtypes); }
// Get all the pertinent countries, hopefully just once public async Task <List <Country> > GetAllPertinentCountries() { var allcountries = await _cache.GetFromTable(_context.Countries); var allpeople = await _cache.GetFromTable(_context.People); if (Allpertinentcountries == null) { Allpertinentcountries = new List <Country>(); foreach (var c in allcountries) { if (allpeople.Any(x => x.IsoCountry == c.Iso)) { Allpertinentcountries.Add(c); } } } return(Allpertinentcountries); }