Exemplo n.º 1
0
        public async Task <IActionResult> Put(int clientId, Client modelClient)
        {
            try
            {
                var client = await _repositoryClient.GetByIdAsync(clientId, false);

                if (client == null)
                {
                    return(NotFound("Didn't find any client!"));
                }

                _repository.Update(modelClient);

                if (!await _repository.SaveChangesAsync())
                {
                    return(BadRequest("Didn't save the client!"));
                }
                return(Ok(modelClient));
            }
            catch (Exception ex)
            {
                return(BadRequest($"Erro: {ex.Message}"));
            }
        }