Exemple #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 Task <ObservableCollection <AddLecturerCourseListItemViewModel> > GetCourseItems()
        {
            ObservableCollection <AddLecturerCourseListItemViewModel> items = new ObservableCollection <AddLecturerCourseListItemViewModel>();
            var courseList = await _courseServices.GetAll();

            foreach (var course in courseList)
            {
                items.Add(new AddLecturerCourseListItemViewModel {
                    Id         = course.Id,
                    Name       = course.CourseName,
                    CourseCode = course.CourseCode,
                    Faculty    = course.Faculty,
                });
            }

            return(items);
        }
Exemple #3
0
        public async void  GetAllCourses()
        {
            var courses = await _services.GetAll();

            foreach (var course in courses)
            {
                Items.Add(
                    new CourseListItemViewModel
                {
                    Id               = course.Id,
                    Initials         = GetInitials(course.CourseName),
                    Name             = course.CourseName,
                    CourseCode       = course.CourseCode,
                    Faculty          = course.Faculty,
                    CoursePictureRGB = RandomRGBColor(),
                    JoinDate         = course.CreatedAt ?? DateTime.MinValue,
                    StudentCount     = course.Sections.Count(),
                    IsSelected       = false,
                }
                    );
            }
        }
Exemple #4
0
        public IHttpActionResult GetAll()
        {
            var result = _courseService.GetAll();

            return(result == null?NotFound() : (IHttpActionResult)Ok(result));
        }