// data for teacher chart
        private ListsForChart StudetsAndCourses()
        {
            ListsForChart listForChart = new ListsForChart();
            using (StoreContext context = new StoreContext())
            {
                var result = context.Enrollments.GroupBy(q => q.CourseRef)
                    .Select(n => new ChartElement
                    {
                        Label = n.Key.CourseTitle,
                        Value = n.Count()//(w => w.StudentRef.Di)
                    })
                    .ToList();

                    listForChart.Labels = new List<string>(result.Select(q=>q.Label).ToList());
                    listForChart.DataSets= new Dictionary<string, List<int>>()
                    { { "Amount of students", new List<int>(result.Select(q => q.Value).ToList()) } };
            }
            return listForChart;
        }
        // data for Admin chart
        private ListsForChart UsersAndRoles()
        {
            ListsForChart listForChart = new ListsForChart();
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            string query = "(select ur.RoleId  Label, count(distinct ur.UserId) Value "
                                                                + "from userroles ur "
                                                                + "group by ur.RoleId) union "
                                                                + "(select 'Student' Label, count(distinct Id) Value "
                                                                + "from users "
                                                                + "where Id not in (select UserId from userroles))";
            using (StoreContext context = new StoreContext())
            {
                var result = context.Database.SqlQuery<ChartElement>(query, parameters).ToList();

                listForChart.Labels = new List<string>(result.Select(q => q.Label).ToList());
                listForChart.DataSets = new Dictionary<string, List<int>>()
                    { { "Amount of users", new List<int>(result.Select(q => q.Value).ToList()) } };
            }
            return listForChart;
        }
        // data for student chart
        private ListsForChart GradesForActivities()
        {
            ListsForChart listForChart = new ListsForChart();
            using (StoreContext context = new StoreContext())
            {
                var result = context.TrainingHistories.Where(q => q.StudentRef.UserName == User.Identity.Name)
                    .GroupBy(q => q.GradeRef)
                    .Select(n => new ChartElement
                    {
                        Label = n.Key.GradeTitle,
                        Value = n.Count()//(w => w.StudentRef.Di)
                    })
                    .ToList();

                listForChart.Labels = new List<string>(result.Select(q => q.Label).ToList());
                listForChart.DataSets = new Dictionary<string, List<int>>()
                    { { "Amount of grades", new List<int>(result.Select(q => q.Value).ToList()) } };
            }
            return listForChart;
        }