Пример #1
0
        public ActionResult Random()
        {
            var randomSub = _subDao.GetRandomSub();

            if (randomSub == null)
            {
                return(Redirect(Url.Subs()));
            }

            return(Redirect(Url.Sub(randomSub.Name)));
        }
Пример #2
0
        public ActionResult Random()
        {
            var randomSubId = _subDao.GetRandomSub(nsfw: _userContext.CurrentNsfw);

            if (randomSubId == null)
            {
                return(Redirect(Url.Subs()));
            }

            var randomSub = _subDao.GetSubById(randomSubId.Value);

            if (randomSub == null)
            {
                return(Redirect(Url.Subs()));
            }

            return(Redirect(Url.Sub(randomSub.Name)));
        }