Example #1
0
        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]));
        }
Example #2
0
        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));
        }
Example #3
0
        public async Task <List <Bagtypes> > GetBagtypes()
        {
            var bagtypes = await _cache.GetFromTable(_context.Types);

            return(bagtypes);
        }
Example #4
0
        // 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);
        }