Beispiel #1
0
 public void CreateComment(Comment comment)
 {
     if (comment.DateOfComment >= DateTime.Today)
     {
         _repo.CreateComment(comment);
     }
 }
        public ActionResult <CommentReadDto> CreateComment(CommentCreateDto commentCreateDto)
        {
            var commentModel = _mapper.Map <Comment>(commentCreateDto);

            _repository.CreateComment(commentModel);
            _repository.SaveChanges();

            var commentReadDto = _mapper.Map <CommentReadDto>(commentModel);

            return(CreatedAtRoute(nameof(GetCommentById),
                                  new { ID = commentReadDto.ID }, commentReadDto));
        }
Beispiel #3
0
 public async void AddComment(string content)
 {
     CommentModel commentModel = JsonSerializer.Deserialize <CommentModel>(content);
     await _commentRepo.CreateComment(commentModel);
 }