Exemplo n.º 1
0
        // public IActionResult Index()
        // {
        //     ViewData["Dados"] = _repository.GetKilledYesterday();
        //     return View();
        // }

        public IActionResult Index()
        {
            var all   = _repository.GetAll();
            var names = all.GroupBy(x => x.BossName).Select(z => z.First().BossName).ToList();

            ICollection <BossData> bossData = new List <BossData>();

            foreach (var name in names)
            {
                var dates = all.Where(x => x.BossName == name).Select(x => x.KilledDate).ToList();

                Calculadora.Calcula(dates,
                                    out int IntervaloMaior,
                                    out int IntervaloMenor,
                                    out int IntervaloFrequente,
                                    out decimal IntervaloMedia,
                                    out int Registros,
                                    out DateTime? LastSee);

                var bossD = new BossData(name,
                                         LastSee,
                                         IntervaloMenor,
                                         IntervaloMaior,
                                         IntervaloMedia,
                                         IntervaloFrequente,
                                         Registros);
                bossData.Add(bossD);
            }

            ViewData["Dados"] = bossData;
            return(View());
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <HistoricoModel> > GetAll()
        {
            var query = await _historicoRepository
                        .GetAll();

            return(query.AsQueryable()
                   .Select(x => _mapper.Map <HistoricoModel>(x)));
        }