Exemplo n.º 1
0
        // 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);
        }
Exemplo n.º 2
0
        // 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());
        }