Ejemplo n.º 1
0
        public ActionResult GetPostByCode(string id)
        {
            if (id == null)
            {
                return(new NotFoundMvc.NotFoundViewResult());
            }
            Post post = BlogServices.FindPost(id);

            if (post == null)
            {
                return(new NotFoundMvc.NotFoundViewResult());
            }
            ViewBag.MetaDescription = post.Description;
            if ((post.IsPublic) || (CodeFirstRoleServices.IsUserInRole(CodeFirstSecurity.IsAuthenticated ? CodeFirstSecurity.CurrentUserName : "******", BgResources.Security_PremiumRole)))
            {
                return(View("Post", post));
            }
            else
            {
                TempData["returnUrl"] = Request.Url.ToString();
                return(RedirectToRoute("Default", new { controller = "Account", action = "LogOn" }));
            }
        }