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

            return(bagtypes);
        }
示例#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);
        }