public async Task <IActionResult> PutPessoa(int id, Pessoa pessoa) { if (id != pessoa.PessoaId) { return(BadRequest()); } _context.Entry(pessoa).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PessoaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "Id,Nome")] Comarca comarca) { if (ModelState.IsValid) { db.Entry(comarca).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(comarca)); }
public ActionResult Edit([Bind(Include = "Id,Nome,ComarcaId")] Vara vara) { if (ModelState.IsValid) { db.Entry(vara).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ComarcaId = new SelectList(db.Comarcas, "Id", "Nome", vara.ComarcaId); return(View(vara)); }
public virtual void Remover(T obj) { _context.Entry(obj).State = EntityState.Deleted; _context.Set <T>().Remove(obj); }
public void Editar(Pessoa pessoa) { db.Entry(pessoa).State = EntityState.Modified; db.SaveChanges(); }