예제 #1
0
        public async Task <IActionResult> Statistics()
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            var shifts = await _context.Shifts.Where(s => s.User == user).ToListAsync();

            var statisticsViewModel = new StatisticsViewModel()
            {
                TotalTips         = _shiftService.GetAllTimeTips(user),
                AverageHourlyWage = _shiftService.GetAverageHourlyWage(shifts),
                AverageTips       = _shiftService.GetAverageTips(shifts)
            };

            return(View(statisticsViewModel));
        }