public ActionResult <IEnumerable <Consumo> > Get() { return(Ok(new { status = "200", msg = "OK", obj = repository.GetAll() })); }
public IActionResult Get() { var sugestao = _consumoRepository.GetAll() .GroupBy(x => x.RestauranteId) .Select(sl => new { Restaurante = sl.First().Restaurante.Nome, Valor = sl.Sum(s => s.Valor) / sl.Count() }).OrderBy(x => x.Valor).FirstOrDefault(); if (sugestao == null) { return(ResponseError("Não existem consumos cadastrados")); } return(ResponseOk(new SugestaoViewModel { Restaurante = sugestao.Restaurante, Valor = sugestao.Valor })); }
public IActionResult Index() { var sugestao = _consumoRepository.GetAll() .GroupBy(x => x.RestauranteId) .Select(sl => new { Restaurante = sl.First().Restaurante.Nome, Valor = sl.Sum(s => s.Valor) / sl.Count() }).OrderBy(x => x.Valor).FirstOrDefault(); if (sugestao == null) { return(View()); } return(View(new SugestaoViewModel { Restaurante = sugestao.Restaurante, Valor = sugestao.Valor })); }
public IActionResult View(int id) { ViewBag.Consumos = consumoRepository.GetAll(); return(View(restauranteRepository.GetById(id))); }
public IActionResult Index() { ViewBag.menorPreco = consumoRepository.GetMenorPreco(); ViewBag.maiorPreco = consumoRepository.GetMaiorPreco(); return(View(consumoRepository.GetAll())); }
public IActionResult Index() { var consumos = _mapper.Map <IEnumerable <ConsumoViewModel> >(_consumoRepository.GetAll()); return(View(consumos)); }
public IActionResult Index() { return(View(consumoRepository.GetAll())); }