Ejemplo n.º 1
0
        // GET: /Blog/Details/5
        public ActionResult Details(int id, int?year, int?month, int?day, string slug)
        {
            SiteBlogPost BlogPost = Caching.GetBlogPost(id);

            if (BlogPost == null)
            {
                // TODOX Should we be throwing a 404 exception here?
                return(HttpNotFound());
            }
            else
            {
                if ((year == BlogPost.DatePosted.Year) && (month == BlogPost.DatePosted.Month) && (day == BlogPost.DatePosted.Day) && (slug == BlogPost.Slug))
                {
                    return(View(BlogPost));
                }
                else
                {
                    return(RedirectToRoutePermanent("BlogPost", BlogPost.ToRouteValues()));
                }
            }
        }