Exemplo n.º 1
0
        public StatisticsViewModel(ApplicationDbContext _context, int dayWeek)
        {
            DoneTasks      = new Dictionary <int, int>();
            DoneTasksNames = new Dictionary <int, string>();
            listDoneTasks  = new List <int>();

            for (int i = dayWeek; i < dayWeek + 7; i++)
            {
                DateTime date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, i); //i+1
                listDoneTasks.Add(Done.GetDoneByDate(date, _context).Count);
                DoneTasks.Add(i, Done.GetDoneByDate(date, _context).Count);             //i+1
            }
            BestDay    = DoneTasks.Max(x => x.Value);
            WorstDay   = DoneTasks.Min(x => x.Value);
            MonthCount = DoneTasks.Sum(x => x.Value);
        }
Exemplo n.º 2
0
        public StatisticsViewModel(ApplicationDbContext _context)
        {
            DoneTasks      = new Dictionary <int, int>();
            DoneTasksNames = new Dictionary <int, string>();
            listDoneTasks  = new List <int>();
            listDoneDay    = new List <int>();

            for (int i = 0; i < DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); i++)
            {
                DateTime date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, i + 1);
                listDoneTasks.Add(Done.GetDoneByDate(date, _context).Count);
                listDoneDay.Add(i + 1);
                DoneTasks.Add(i + 1, Done.GetDoneByDate(date, _context).Count);
            }

            BestDay    = DoneTasks.Max(x => x.Value);
            WorstDay   = DoneTasks.Min(x => x.Value);
            MonthCount = DoneTasks.Sum(x => x.Value);
        }