示例#1
0
        public async Task <IActionResult> Update(ClienteDTO clienteDTO)
        {
            if (ModelState.IsValid)
            {
                Cliente cliente = await clienteServices.GetAsync(clienteDTO.CPF);

                if (cliente == null)
                {
                    return(NotFound());
                }

                cliente.Nome     = clienteDTO.Nome;
                cliente.Sexo     = clienteDTO.Sexo;
                cliente.Birthday = clienteDTO.Birthday;
                await clienteServices.UpdateAsync(cliente);

                return(Ok(cliente));
            }
            return(UnprocessableEntity(ModelState));
        }