public async Task <IActionResult> PutAreaAtendimento([FromRoute] int id, [FromBody] AreaAtendimento areaAtendimento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != areaAtendimento.CdAreaatendimento) { return(BadRequest()); } _context.Entry(areaAtendimento).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AreaAtendimentoExists(id)) { return(NotFound()); } else { throw; } } return(Ok(areaAtendimento)); }
public async Task <IActionResult> PostAreaAtendimento([FromBody] AreaAtendimento areaAtendimento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.AreaAtendimento.Add(areaAtendimento); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAreaAtendimento", new { id = areaAtendimento.CdAreaatendimento }, areaAtendimento)); }