public ActionResult Create(comentario comentario) { if (ModelState.IsValid) { db.comentario.Add(comentario); db.SaveChanges(); } ViewBag.cod_restaurante = new SelectList(db.restaurante, "cod", "nome", comentario.cod_restaurante); // Variável do tipo TemData utilizada para armazenar o valor temporário entre os controllers int idreturn = (int)TempData["id1"]; //var id = db.restaurante.AsParallel(new SelectList(db.restaurante, "cod"); return RedirectToAction("Details", "Home", new { id = idreturn }); }
public ActionResult Edit(comentario comentario) { if (ModelState.IsValid) { db.Entry(comentario).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.cod_restaurante = new SelectList(db.restaurante, "cod", "nome", comentario.cod_restaurante); return View(comentario); }