public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit(Avaliacao avaliacao) { if (ModelState.IsValid) { db.Avaliacoes.Attach(avaliacao); foreach (var item in avaliacao.ItensAvaliacao) { db.Entry(item).State = EntityState.Modified; } avaliacao.Avaliado = true; avaliacao.DataAvaliado = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Index", "Solicitacao")); } avaliacao = db.Avaliacoes.Find(avaliacao.Id); return(View(avaliacao)); }