예제 #1
0
        public async Task GetRandomSubverse_Test()
        {
            //Right now we just want to make sure no error occurs

            var q = new QueryRandomSubverse(false);
            var randomSubverse = await q.ExecuteAsync();

            //Assert.IsNotNull(randomSubverse);

            q = new QueryRandomSubverse(true);
            randomSubverse = await q.ExecuteAsync();

            //Assert.IsNotNull(randomSubverse);
        }
        // GET: fetch a random NSFW subbverse with x subscribers and x submissions
        public async Task <ActionResult> RandomNsfw()
        {
            try
            {
                var q = new QueryRandomSubverse(true);
                var randomSubverse = await q.ExecuteAsync();

                if (!String.IsNullOrEmpty(randomSubverse))
                {
                    return(RedirectToRoute(ROUTE_NAMES.SUBVERSE_INDEX, new { subverse = randomSubverse }));
                }
                else
                {
                    return(RedirectToRoute(ROUTE_NAMES.FRONT_INDEX));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }