public ActionResult <IEnumerable <Comment> > GetCommentsByBlogId(int id) { try { return(Ok(_commentsService.GetCommentsByBlogId(id))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <Blog> GetCommentByBlogId(int id) { try { return(Ok(_cservice.GetCommentsByBlogId(id))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <IEnumerable <Comment> > GetCommentsByBlogId(int id) { try { IEnumerable <Comment> comments = _cService.GetCommentsByBlogId(id); return(Ok(comments)); } catch (Exception e) { return(BadRequest(e.Message)); } }
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)); } }