private Pedido InicializaTela(Pedido pedido) { // Opcionais OpcionalService opcionalService = new OpcionalService(); pedido.Opcionais = opcionalService.List(); using (Context db = new Context()) { // DropDownList Bebida if(pedido.BebidaId != 0) ViewBag.BebidaId = new SelectList(db.Bebida.ToList(), "Id", "Nome", pedido.BebidaId); else ViewBag.BebidaId = new SelectList(db.Bebida.ToList(), "Id", "Nome"); // DropDownList Lanche if(pedido.LancheId != 0) ViewBag.LancheId = new SelectList(db.Lanche.ToList(), "Id", "Nome", pedido.LancheId); else ViewBag.LancheId = new SelectList(db.Lanche.ToList(), "Id", "Nome"); } return pedido; }
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; }