public async Task <IActionResult> PutCidade([FromRoute] int id, [FromBody] Cidade cidade)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cidade.CdCidade)
            {
                return(BadRequest());
            }

            _context.Entry(cidade).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CidadeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutUsuarioAreaatendimento([FromRoute] int id, [FromBody] UsuarioAreaatendimento usuarioAreaatendimento)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != usuarioAreaatendimento.CdUsuarioatendimento)
            {
                return(BadRequest());
            }

            _context.Entry(usuarioAreaatendimento).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UsuarioAreaatendimentoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutHistoricoSenha([FromRoute] int id, [FromBody] HistoricoSenha historicoSenha)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != historicoSenha.CdHistoricosenha)
            {
                return(BadRequest());
            }

            _context.Entry(historicoSenha).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HistoricoSenhaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutAreaAtuacao([FromRoute] int id, [FromBody] AreaAtuacao areaAtuacao)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != areaAtuacao.CdAreaatuacao)
            {
                return(BadRequest());
            }

            _context.Entry(areaAtuacao).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AreaAtuacaoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetAreaAtuacao", new { id = areaAtuacao.CdAreaatuacao }, areaAtuacao));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> PutImagemOcorrencia([FromRoute] int id, [FromBody] ImagemOcorrencia imagemOcorrencia)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != imagemOcorrencia.CdImagem)
            {
                return(BadRequest());
            }

            _context.Entry(imagemOcorrencia).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ImagemOcorrenciaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }