public IHttpActionResult PutUsuario(int id, Usuario usuario) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != usuario.UsuarioId) { return(BadRequest()); } db.Entry(usuario).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UsuarioExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,Nome")] Categoria categoria) { if (ModelState.IsValid) { db.Entry(categoria).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categoria)); }
public ActionResult Edit([Bind(Include = "Id,Nome,Titulo,Icon,Estado,Action,Controller")] Menu menu) { if (ModelState.IsValid) { db.Entry(menu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(menu)); }
public ActionResult Edit([Bind(Include = "Id,Nome,DataInicio,DataFim,Valor,Situacao")] Periodo periodo) { if (ModelState.IsValid) { db.Entry(periodo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(periodo)); }
public ActionResult Edit(Movimentacao movimentacao) { if (ModelState.IsValid) { db.Entry(movimentacao).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoriaId = new SelectList(db.Categorias, "Id", "Nome", movimentacao.CategoriaId); ViewBag.PeriodoId = new SelectList(db.Periodos.Where(x => x.Situacao.Equals(false)), "Id", "Nome"); return(View(movimentacao)); }
public void atualizar(TEntity objeto) { Db.Entry(objeto).State = EntityState.Modified; Db.SaveChanges(); }