using Diligent.WebAPI.Contracts.DTOs.Comment; namespace Diligent.WebAPI.Business.Services { public class CommentService : ICommentService { private readonly DatabaseContext _context; private readonly IMapper _mapper; public CommentService(DatabaseContext context, IMapper mapper) { _context = context; _mapper = mapper; } public async Task CreateComment(CommentCreateDto commentCreateDto) { var comment = _mapper.Map(commentCreateDto); comment.DateOfSending = DateTime.Now; await _context.Comments.AddAsync(comment); await _context.SaveChangesAsync(); } } }