async public Task <ActionResult> Random()
        {
            int    total  = _memeRepo.Count();
            Random r      = new Random();
            int    offset = r.Next(0, total);

            List <MemeResponse> memes = await _memeRepo.GetAllMemesAsync();

            if (memes.Count == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }
            MemeResponse meme = memes[offset];

            //return RedirectToAction("Details", new { id = offset });
            return(View(meme));
        }
Example #2
0
 async public Task <List <MemeResponse> > GetAllMemes()
 {
     return(await _memeRepo.GetAllMemesAsync());
 }