Ejemplo n.º 1
0
        public async Task <IActionResult> GetAllAsyncFromPostAsync(string postId, int from = 0, int number = 10)
        {
            try
            {
                var comments = await _postCommentService.GetAllFromPostAsync(postId, from, number);

                if (comments == null)
                {
                    NotFound();
                }
                return(Json(comments));
            }
            catch (Exception e)
            {
                _logger.LogError($"Returning exception: {e.Message}");
                return(Json(new ExceptionDto
                {
                    Error = e.Message
                }));
            }
        }