Esempio n. 1
0
        public async Task <CommentDto> CreateCommentAsync(int userLogged, int beerId, SaveCommentDto commentDto)
        {
            var comment = _mapper.Map <SaveCommentDto, Comment>(commentDto);

            comment.BeerId         = beerId;
            comment.UserId         = userLogged;
            comment.CreateDateTime = DateTime.Now;
            await _repository.AddAsyn(comment);

            await _repository.SaveAsync();

            return(await GetCommentAsync(comment.Id));
        }