示例#1
0
        public IActionResult Index()
        {
            pizza   = JsonConvert.DeserializeObject <Pizza>(_utilsSession.RetonarPizza());
            pizzas  = JsonConvert.DeserializeObject <List <ItemPizza> >(_utilsSession.RetonarPizzas());
            bebidas = JsonConvert.DeserializeObject <List <ItemBebida> >(_utilsSession.RetonarBebidas());
            preco   = JsonConvert.DeserializeObject <double>(_utilsSession.RetonarPreco());

            if (pizza.Tamanho != null)
            {
                ViewBag.Tamanho = pizza.Tamanho.Nome;
            }

            if (pizza.itemSabores.Count != 0)
            {
                foreach (ItemSabor sabor in pizza.itemSabores)
                {
                    ViewBag.Sabor += sabor.Sabor.Nome + ", ";
                }
            }

            if (bebidas.Count != 0)
            {
                foreach (ItemBebida bebida in bebidas)
                {
                    ViewBag.Bebida += bebida.Bebida.Nome + ", ";
                }
            }

            ViewBag.Preco = preco;

            /*if (TempData["Sabor"] != null)
             * {
             *  ViewBag.Sabor = TempData["Sabor"].ToString();
             * }
             * if (TempData["Bebida"] != null)
             * {
             *  ViewBag.Bebida = TempData["Bebida"].ToString();
             * }*/

            ViewBag.ListaTamanho = _tamanhoDAO.Listar();
            ViewBag.ListaSabor   = _saborDAO.Listar();
            ViewBag.ListaBebida  = _bebidaDAO.Listar();
            return(View(venda));
        }
 public IActionResult Index()
 {
     ViewBag.ListaSabor = _bebidaDAO.Listar();
     return(View());
 }