public async Task <ActionResult> Update(int id, ClienteCreateTO clie) { var cliente = await _repository.Get(id); if (cliente == null) { return(NotFound()); } return(Ok(await _serviceCliente.Update(_mapper.Map(clie, cliente)))); }
public async Task <ActionResult> Create(ClienteCreateTO clie) { if (clie == null) { throw new ArgumentNullException(nameof(clie)); } var Cliente = _mapper.Map <Cliente>(clie); var result = await _serviceCliente.Create(Cliente); var ClienteTO = _mapper.Map <ClienteTO>(Cliente); return(CreatedAtAction(nameof(Obter), new { id = ClienteTO.Id }, ClienteTO)); }