public IEnumerable <AppointmentBookedChartViewModel> GetAppointmentBookedChartForLastSevenDays(AppointmentBookedChartStatus appointmentBookedType)
        {
            var eventCustomers = _eventCustomerRepository.GetAppointmentBookedChartForLastSevenDays(appointmentBookedType).ToArray();

            return(new List <AppointmentBookedChartViewModel>
            {
                new AppointmentBookedChartViewModel {
                    BookedAppointmentCustomers = eventCustomers.Where(x => x.DataRecorderMetaData.DateCreated.Date == DateTime.Now.Date).Count(), BookedAppointmentDate = DateTime.Now.Date.ToString("MMM dd")
                },
                new AppointmentBookedChartViewModel {
                    BookedAppointmentCustomers = eventCustomers.Where(x => x.DataRecorderMetaData.DateCreated.Date == DateTime.Now.AddDays(-1).Date).Count(), BookedAppointmentDate = DateTime.Now.AddDays(-1).ToString("MMM dd")
                },
                new AppointmentBookedChartViewModel {
                    BookedAppointmentCustomers = eventCustomers.Where(x => x.DataRecorderMetaData.DateCreated.Date == DateTime.Now.AddDays(-2).Date).Count(), BookedAppointmentDate = DateTime.Now.AddDays(-2).ToString("MMM dd")
                },
                new AppointmentBookedChartViewModel {
                    BookedAppointmentCustomers = eventCustomers.Where(x => x.DataRecorderMetaData.DateCreated.Date == DateTime.Now.AddDays(-3).Date).Count(), BookedAppointmentDate = DateTime.Now.AddDays(-3).ToString("MMM dd")
                },
                new AppointmentBookedChartViewModel {
                    BookedAppointmentCustomers = eventCustomers.Where(x => x.DataRecorderMetaData.DateCreated.Date == DateTime.Now.AddDays(-4).Date).Count(), BookedAppointmentDate = DateTime.Now.AddDays(-4).ToString("MMM dd")
                },
                new AppointmentBookedChartViewModel {
                    BookedAppointmentCustomers = eventCustomers.Where(x => x.DataRecorderMetaData.DateCreated.Date == DateTime.Now.AddDays(-5).Date).Count(), BookedAppointmentDate = DateTime.Now.AddDays(-5).ToString("MMM dd")
                },
                new AppointmentBookedChartViewModel {
                    BookedAppointmentCustomers = eventCustomers.Where(x => x.DataRecorderMetaData.DateCreated.Date == DateTime.Now.AddDays(-6).Date).Count(), BookedAppointmentDate = DateTime.Now.AddDays(-6).ToString("MMM dd")
                },
            });
        }
Пример #2
0
        public ActionResult GetBookedAppointmentChart(AppointmentBookedChartStatus type)
        {
            var model = _appointmentBookedReportingService.GetAppointmentBookedChartForLastSevenDays(type);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }