public IActionResult Update(long id, [FromBody] HeritageCommentDto item)
        {
            //set bad reqeust if  contact data is not provided in body
            if (item == null || id == 0)
            {
                return(BadRequest());
            }
            var comment = _mapper.Map <HeritageComment>(item);

            var heritageComment = _context.HeritageComments.FirstOrDefault(t => t.Id == id);

            if (heritageComment == null)
            {
                return(NotFound());
            }
            heritageComment.HeritageId    = comment.HeritageId;
            heritageComment.CommentUserId = comment.CommentUserId;
            heritageComment.CommentText   = comment.CommentText;
            heritageComment.CommentDate   = DateTime.Now;
            heritageComment.UpVoteCount   = comment.UpVoteCount;
            heritageComment.DownVoteCount = comment.DownVoteCount;

            _context.SaveChanges();
            item = _mapper.Map <HeritageCommentDto>(comment);
            return(Ok(item));
        }
        public IActionResult Add([FromBody] HeritageCommentDto item)
        {
            //set bad reqeust if contact data is not provided in body
            if (item == null)
            {
                return(BadRequest());
            }

            var comment = _mapper.Map <HeritageComment>(item);

            comment.CommentDate = DateTime.Now;
            _context.HeritageComments.Add(comment);
            _context.SaveChanges();
            item = _mapper.Map <HeritageCommentDto>(comment);
            return(Ok(item));
        }