public virtual ActionResult Blog(string alias) { var id = _urlShortener.Extend(alias); PostModel post; try { post = _blogRepository.Get(id); } catch (EntityNotFoundException) { return(NotFound()); } return(RedirectPermanent(Url.BlogPost(post))); }
public virtual ActionResult ShortUrl(string alias) { var id = _urlShortener.Extend(alias); PostModel post; try { // TODO: Add a GetSummary method and use that instead post = _blogRepository.Get(id); } catch (Exception) { return(HttpNotFound(string.Format("Blog post {0} for short URL '{1}' not found.", id, alias))); } return(RedirectPermanent(Url.BlogPost(post))); }