Beispiel #1
0
        public async Task <IActionResult> Index()
        {
            if (!_httpContextAccessor.HttpContext.IsUserLoggedIn())
            {
                return(RedirectToAction("Index", "Access"));
            }

            DashboardDto data = new DashboardDto
            {
                Opened = await _appointmentRepository
                         .Count(a => !a.IsDeleted && a.Status.Id == (int)AppointmentStatusEnum.Opened),
                Closed = await _appointmentRepository
                         .Count(a => !a.IsDeleted && a.Status.Id == (int)AppointmentStatusEnum.Closed),
                Pending = await _appointmentRepository
                          .Count(a => !a.IsDeleted && a.Status.Id == (int)AppointmentStatusEnum.Pending),
                Cancelled = await _appointmentRepository
                            .Count(a => !a.IsDeleted && a.Status.Id == (int)AppointmentStatusEnum.Cancelled)
            };

            data.ClosedAvg = Math.Round(data.Closed / (double)await _appointmentRepository.Count(), 2);

            return(View(data));
        }