| 1234567891011121314151617181920212223242526 |
- 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<Comment>(commentCreateDto);
-
- comment.DateOfSending = DateTime.Now;
-
- await _context.Comments.AddAsync(comment);
-
- await _context.SaveChangesAsync();
- }
- }
- }
|