Esempio n. 1
0
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var lanche = _serviceLanche.Get(id);

            decimal valTotalLanche = 0;

            foreach (var ingrediente in lanche.LanchesIngredientes)
            {
                valTotalLanche += (ingrediente.Ingrediente.Preco * ingrediente.QtdIngrediente);
            }
            lanche.Preco = valTotalLanche;

            ViewBag.Ingredientes = (IEnumerable <Domain.Models.Ingrediente>)_serviceIngrediente.GetAll();

            if (lanche == null)
            {
                return(NotFound());
            }

            return(View(lanche.ToViewModel()));
        }
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var lanche = _serviceLanche.Get(id);

            if (lanche == null)
            {
                return(NotFound());
            }

            return(View(lanche.ToViewModel()));
        }