public async Task <IActionResult> putProduct([FromBody] Producto producto) { db.Productos.Attach(producto); db.Entry(producto).State = EntityState.Modified; await db.SaveChangesAsync(); return(Ok()); }
public async Task <IActionResult> PutCorreioEletronico(short ano, long id, CorreioEletronico correioEletronico) { if (id != correioEletronico.CodEntidade || ano != correioEletronico.Ano) { return(BadRequest()); } _context.Entry(correioEletronico).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CorreioEletronicoExists(ano, id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutMantenedoraDaEscola(long id, MantenedoraDaEscola mantenedoraDaEscola) { if (id != mantenedoraDaEscola.CodEntidade) { return(BadRequest()); } _context.Entry(mantenedoraDaEscola).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MantenedoraDaEscolaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutEstado(long id, Estado estado) { if (id != estado.CodEstado) { return(BadRequest()); } _context.Entry(estado).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EstadoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTelefone(long num, short ano, long id, Telefone telefone) { if (id != telefone.CodEntidade || ano != telefone.Ano || num != telefone.Numero) { return(BadRequest()); } _context.Entry(telefone).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TelefoneExists(num, ano, id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutRegiao(short id, Regiao regiao) { if (id != regiao.CodRegiao) { return(BadRequest()); } _context.Entry(regiao).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegiaoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutUser(long id, User user) { if (id != user.Id) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }