// GET: Votes/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } VotesModel votesModel = db.Votes.Find(id); if (votesModel == null) { return HttpNotFound(); } // Cria Média aqui var bandejaoController = new BandejaoController(); bandejaoController.VotosMedia(); ViewBag.CardapioItemId = new SelectList(db.CardapioItem, "CardapioItemId", "Nome", votesModel.CardapioItemId); return View(votesModel); }
// GET: Votes public ActionResult Index() { var votes = db.Votes.Include(v => v.CardapioItem); // Cria Média aqui var bandejaoController = new BandejaoController(); bandejaoController.VotosMedia(); return View(votes.ToList()); }