public ActionResult <IEnumerable <Comment> > GetCommentsByBlogId(int id)
 {
     try
     {
         return(Ok(_commentsService.GetCommentsByBlogId(id)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
Exemplo n.º 2
0
 public ActionResult <Blog> GetCommentByBlogId(int id)
 {
     try
     {
         return(Ok(_cservice.GetCommentsByBlogId(id)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
Exemplo n.º 3
0
 public ActionResult <IEnumerable <Comment> > GetCommentsByBlogId(int id)
 {
     try
     {
         IEnumerable <Comment> comments = _cService.GetCommentsByBlogId(id);
         return(Ok(comments));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemplo n.º 4
0
 public ActionResult <IEnumerable <Comment> > GetComments(int id)
 {
     try
     {
         Blog blog = _bservice.GetById(id);
         if (blog == null)
         {
             throw new System.Exception("Invalid Id");
         }
         return(Ok(_cservice.GetCommentsByBlogId(blog.Id)));
     }
     catch (System.Exception e)
     {
         return(BadRequest(e.Message));
     }
 }