public IQueryable <AlunoLanche> GetForRelatorio(AlunoLancheFilter filter) { var alunoLanche = _context.AlunoLanche .Include(al => al.Aluno) .Include(al => al.Lanche).AsQueryable(); if (filter.Curso != null) { alunoLanche = alunoLanche.Where(al => al.Aluno.Curso.Equals(filter.Curso)); } if (filter.Nivel != null) { alunoLanche = alunoLanche.Where(al => al.Aluno.Nivel.Equals(filter.Nivel)); } if (filter.Turno != null) { alunoLanche = alunoLanche.Where(al => al.Lanche.Turno.Equals(filter.Turno)); } if (filter.Dia != null) { alunoLanche = alunoLanche.Where(al => al.Lanche.Dia.Day == filter.Dia.Day && al.Lanche.Dia.Month == filter.Dia.Month && al.Lanche.Dia.Year == filter.Dia.Year); } return(alunoLanche); }
public IActionResult CountAlunos(AlunoLancheFilter filter) { //Console.WriteLine(filter.Dia); // var valorFinal = 0.0; var alunoLache = _repository.GetForRelatorio(filter).Count(); // foreach(var al in alunoLache){ // var estoque = _estoqueRepository.GetByCOD(al.Lanche.COD_Estoque); // valorFinal += estoque.Valor; // } return(Ok(alunoLache)); }
public IActionResult GetValorGasto(AlunoLancheFilter filter) { //Console.WriteLine(filter.Dia); var valorFinal = 0.0; var alunoLache = _repository.GetForRelatorio(filter); foreach (var al in alunoLache) { var estoque = _estoqueRepository.GetByCOD(al.Lanche.COD_Estoque); valorFinal += estoque.Valor; } return(Ok(valorFinal)); }
public IActionResult GetRelatorio(AlunoLancheFilter filter) { if (filter.Nivel != null) { if (filter.Nivel.Equals("Técnico")) { filter.Nivel = "Tecnico"; } } var alunoLache = _repository.GetForRelatorio(filter); var result = _mapper.Map <IEnumerable <RelatorioViewModel> >(alunoLache); return(Ok(result)); }