示例#1
0
 internal Author(Domain.Entities.Author author)
 {
     Id          = author.Id;
     FirstName   = author.Name;
     LastName    = author.SurName;
     DateOfBirth = author.LifePeriod.DateOfBirth;
     DateOfDeath = author.LifePeriod.DateOfDeath;
 }
示例#2
0
        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));
        }
示例#3
0
        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
            });
        }