Ejemplo n.º 1
0
 public ActionResult GetBlogPost(string slug)
 {
     try
     {
         BlogPost blogPost = _blogLogic.GetBlogBySlug(slug);
         if (blogPost == null)
         {
             return(new BadRequestResult());
         }
         BlogPostVM blogPostToSend = new BlogPostVM();
         blogPostToSend.blogPost = blogPost;
         return(Ok(blogPostToSend));
     }
     catch (KeyNotFoundException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (Exception)
     {
         throw;
     }
 }