Пример #1
0
        public ViewResult Post(int year, int month, string title)
        {
            var post = repo.Post(year, month, title);

            if (post == null)
            {
                throw new HttpException(404, "Post not found");
            }

            if (post.Published == false && User.Identity.IsAuthenticated == false)
            {
                throw new HttpException(401, "The post is not published");
            }

            return(View(post));
        }
Пример #2
0
        public ActionResult GoToPost(int id)
        {
            var post = repo.Post(id);

            return(RedirectToRoute(new { controller = "BlogNew", action = "Post", year = post.PostedDate.Year, month = post.PostedDate.Month, title = post.UrlName }));
        }