public async Task <ActionResult> Put(int id, AuthorUpsertDto authorUpsertDto) { await _authorService.UpdateAuthor(id, authorUpsertDto); _logger.LogInformation(LogMessages.EntityUpdated); return(Ok()); }
public async Task <ActionResult> Post(AuthorUpsertDto authorUpsertDto) { var authorReadDto = await _authorService.CreateAuthorReadDto(authorUpsertDto); _logger.LogInformation(LogMessages.EntityCreated); return(CreatedAtAction(nameof(Get), new { authorReadDto.Id }, authorReadDto)); }
public async Task MapPatch(Author author, AuthorUpsertDto dto) { _mapper.Map(dto, author); await _unitOfWork.Authors.Update(author); await _unitOfWork.Save(); }
public async Task UpdateAuthor(int id, AuthorUpsertDto authorUpsertDto) { var author = await FindAuthor(id); _mapper.Map(authorUpsertDto, author); await _unitOfWork.Authors.Update(author); await _unitOfWork.Save(); }
public async Task <AuthorReadDto> CreateAuthorReadDto(AuthorUpsertDto authorUpsertDtoDto) { var author = _mapper.Map <Author>(authorUpsertDtoDto); await _unitOfWork.Authors.Create(author); await _unitOfWork.Save(); return(_mapper.Map <AuthorReadDto>(author)); }