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)); }
public async void AddComment(string content) { CommentModel commentModel = JsonSerializer.Deserialize <CommentModel>(content); await _commentRepo.CreateComment(commentModel); }