Created
April 8, 2020 21:34
-
-
Save rafaeldalsenter/5b314569f43231553a375bb1f88d1cf4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClienteServices : IClienteServices | |
{ | |
private readonly IMediator _mediator; | |
private readonly IMapper _mapper; | |
private readonly IClienteForQueryRepository _clienteForQueryRepository; | |
public ClienteServices(IMediator mediator, | |
IMapper mapper, | |
IClienteForQueryRepository clienteForQueryRepository) | |
{ | |
_mapper = mapper; | |
_mediator = mediator; | |
_clienteForQueryRepository = clienteForQueryRepository; | |
} | |
public async Task<CommandReturnDto> Add(ClienteDto dto) | |
=> await _mediator.Send(_mapper.Map<CreateClienteCommand>(dto)); | |
public async Task<CommandReturnDto> Delete(int id) | |
=> await _mediator.Send(new RemoveClienteCommand(id)); | |
public ClienteDto GetById(int id) | |
=> _clienteForQueryRepository.GetById(id); | |
public async Task<CommandReturnDto> Update(ClienteDto dto) | |
=> await _mediator.Send(_mapper.Map<UpdateClienteCommand>(dto)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment