Beispiel #1
0
        public async Task <StatisticsData> GetAll()
        {
            var stastics = new StatisticsData();

            var users = await _accountService.GetAll();

            var courses = await _courseServices.GetAll();

            var lectuers = await _lecturerServices.GetAll();

            var students = await _studentService.GetAll();

            var registrations = await _registrationService.GetAll();

            var attendances = await _attendanceService.GetAll();

            var sections = await _courseServices.GetAllSections();

            stastics.Users            = users.Count();
            stastics.Courses          = courses.Count();
            stastics.Lecturers        = lectuers.Count();
            stastics.Students         = students.Count();
            stastics.Registrations    = registrations.Count();
            stastics.StudentFaceAdded = students.Where(s => s.FaceAdded == true).ToList().Count();
            stastics.Attendances      = attendances.Count();
            int percent = (100 * (attendances.Where(at => at.AttendanceType == 1).ToList().Count())) / stastics.Attendances;

            stastics.AttendancePercent = percent;
            stastics.LastUpdate        = DateTime.Now;
            stastics.Sections          = sections.Count();
            return(stastics);
        }
        private async void GetCourses()
        {
            var allSections = await _courseServices.GetAllSections();

            foreach (var section in allSections)
            {
                CourseListItems.Add(
                    new AddStudentCourseListItemViewModel
                {
                    SectionId    = section.Id,
                    CourseCode   = section.Course.CourseCode,
                    Name         = section.Course.CourseName,
                    LecturerName = section.Lecturer.User.Name,
                    IsSelected   = false
                });
            }
        }