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 Edit(int?id) { if (id == null) { return(NotFound()); } var lanche = _serviceLanche.Get(id); var ingredientes = _serviceIngrediente.GetAll(); ViewBag.Ingredientes = ingredientes; if (lanche == null) { return(NotFound()); } return(View(lanche.ToViewModel())); }
public IActionResult Index() { return(View(_service.GetAll().ToViewsModels())); }
public new IEnumerable <Ingrediente> GetAll() { return(_service.GetAll()); }