public IActionResult GetAll()
        {
            IList <Comment> list = _CommentDal.GetList();

            if (list != null && list.Count > 0)
            {
                return(Ok(list));
            }
            else
            {
                return(NotFound("Burada hiç kayıt bulunmadı!"));
            }
        }
Exemple #2
0
        public IDataResult <List <CommentDTO> > GetComments(Guid foodId)
        {
            var comments = _commentDAL.GetList(f => f.FoodID == foodId);
            List <CommentDTO> commentDTOs = new List <CommentDTO>();

            foreach (var comment in comments)
            {
                var cmtDto = new CommentDTO
                {
                    Comments       = comment,
                    CommentReplies = _commentDAL.GetCommentReplies(comment.ID)
                };
                commentDTOs.Add(cmtDto);
            }
            return(new SuccessDataResult <List <CommentDTO> >(commentDTOs));
        }