public ActionResult Index() { Home home = new Home(); try { if (User.Identity.IsAuthenticated) { // Carrega o cardápio LancheService lancheService = new LancheService(); home.Lanches = lancheService.List(); OpcionalService opcionalService = new OpcionalService(); home.Opcionais = opcionalService.List(); BebidaService bebidaService = new BebidaService(); home.Bebidas = bebidaService.List(); } } catch (Exception ex) { ViewBag.Error = ex.Message; } return View(home); }
// // GET: /Bebida/ public ViewResult Index() { IList<Bebida> bebidas = null; try { BebidaService bebidaService = new BebidaService(); bebidas = bebidaService.List(); } catch (Exception ex) { ViewBag.Error = ex.Message; } return View(bebidas); }
private Fechamento InicializaTela(Fechamento fechamento) { BebidaService bebidaService = new BebidaService(); fechamento.BebidasDisponiveis = bebidaService.List(); using (Context db = new Context()) { // DropDownList Bebida if (fechamento.BebidaId != 0) ViewBag.Bebidas = new SelectList(db.Bebida.ToList(), "Id", "Nome", fechamento.BebidaId); else ViewBag.Bebidas = new SelectList(db.Bebida.ToList(), "Id", "Nome"); } return fechamento; }