Example #1
0
        public async Task <Guid> SubmitComment(ApplicationUser user, Guid refId, string comment)
        {
            var feed = _feedRepository.GetFeedAsync(refId);

            if (feed == null)
            {
                throw new BusinessException("FeedNotFound", "Kayıt bulunamadı.");
            }

            var newComment = new Comment();

            newComment.CreateDate  = DateTime.UtcNow;
            newComment.RefId       = refId;
            newComment.User        = user;
            newComment.UserComment = comment;

            await _feedRepository.SaveCommentAsync(newComment);

            await _feedRepository.ChangeCommentCountAsync(refId, 1);

            await _unitOfWork.CompleteAsync();

            return(newComment.Id);
        }