Beispiel #1
0
        public async Task <IViewComponentResult> InvokeAsync(int postId)
        {
            var comments = await _commentManager.GetComments(postId);

            var models = _mapper.Map <IList <CommentViewModel> >(comments);

            return(View("Comments", models));
        }
        public HttpResponseMessage GetComments(int id)
        {
            IEnumerable <CommentVM> comments = new List <CommentVM>();

            try
            {
                comments = commentManager.GetComments(id);
            }
            catch (Exception ex)
            {
                ErrorStore.LogException(ex, System.Web.HttpContext.Current);
            }
            return(Request.CreateResponse(HttpStatusCode.OK, comments));
        }
Beispiel #3
0
        public ActionResult <IEnumerable <Comment> > GetComments(int id)
        {
            _logger.LogInformation("Call GetComments method with id {id}", id);

            var article = _articleManager.GetArticleById(id);

            if (article == null)
            {
                throw new EntityNotFoundException(typeof(Article), id);
            }

            var comments = _commentManager.GetComments(id);

            return(Ok(comments));
        }
 public IEnumerable <CommentDto> GetComments(Guid id)
 {
     return(_commentManager.GetComments(id));
 }