Esempio n. 1
0
 public IEnumerable <T> GetAllByStudentInSpecifiedRange <T>(GetAllByStudentInIntervalInputModel input)
 {
     return(this.absencesRepository
            .All()
            .Where(a => a.CourseId == input.CourseId && a.StudentId == input.StudentId && a.Lecture.StartDate >= input.StartDate && a.Lecture.StartDate <= input.EndDate)
            .OrderBy(a => a.Id)
            .To <T>()
            .ToList());
 }
Esempio n. 2
0
        public async Task <IActionResult> AllByStudentInInterval()
        {
            ApplicationUser user = await this.userManager.GetUserAsync(this.User);

            GetAllByStudentInIntervalInputModel input = new GetAllByStudentInIntervalInputModel
            {
                StudentItems = this.studentsService.GetAllByParentAsSelectListItems(user.ParentId),
                CourseItems  = this.coursesService.GetAllAsSelectListItems(),
            };

            return(this.View(input));
        }
Esempio n. 3
0
        public async Task <IActionResult> AllByStudentInInterval(GetAllByStudentInIntervalInputModel input)
        {
            ApplicationUser user = await this.userManager.GetUserAsync(this.User);

            if (!this.ModelState.IsValid)
            {
                input.StudentItems = this.studentsService.GetAllByParentAsSelectListItems(user.Id);
                input.CourseItems  = this.coursesService.GetAllAsSelectListItems();
                return(this.View(input));
            }

            GetAllByStudentInIntervalListViewModel viewModel = new GetAllByStudentInIntervalListViewModel
            {
                Students  = this.absencesService.GetAllByStudentInSpecifiedRange <GetAllByStudentInIntervalViewModel>(input),
                StartDate = input.StartDate,
                EndDate   = input.EndDate,
            };

            this.ViewBag.CourseName = this.coursesService.CourseNameByStudentAndCourse(input.StudentId, input.CourseId);

            return(this.View("AllByStudentInIntervalResult", viewModel));
        }