internal Author(Domain.Entities.Author author) { Id = author.Id; FirstName = author.Name; LastName = author.SurName; DateOfBirth = author.LifePeriod.DateOfBirth; DateOfDeath = author.LifePeriod.DateOfDeath; }
public async Task <AuthorResponse> AddAuthorAsync(AddAuthorRequest request) { var item = new Domain.Entities.Author { AuthorName = request.AuthorName }; var result = _artistRepository.Add(item); await _artistRepository.UnitOfWork.SaveChangesAsync(); return(_artistMapper.Map(result)); }
public async Task <AuthorDTO> Handle(AddAuthorCommand request, CancellationToken cancellationToken) { var author = new Domain.Entities.Author(request.Name); _context.Authors.Add(author); await _context.SaveChangesAsync(cancellationToken); return(new AuthorDTO { Id = author.Id.ToString(), Name = author.Name }); }