public async Task <IActionResult> PostTelefoneAreaatendimento([FromBody] TelefoneAreaatendimento telefoneAreaatendimento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TelefoneAreaatendimento.Add(telefoneAreaatendimento); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTelefoneAreaatendimento", new { id = telefoneAreaatendimento.CdTelefoneareaatendimento }, telefoneAreaatendimento)); }
public async Task <IActionResult> PutTelefoneAreaatendimento([FromRoute] int id, [FromBody] TelefoneAreaatendimento telefoneAreaatendimento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != telefoneAreaatendimento.CdTelefoneareaatendimento) { return(BadRequest()); } _context.Entry(telefoneAreaatendimento).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TelefoneAreaatendimentoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }