Example #1
0
        public async Task <IActionResult> AddStudentClass()
        {
            var schoolId = await this.userService.GetSchoolIdForUser(UserId);

            var students = await this.studentService.GetAll(schoolId);

            var classes = await this.classService.GetAll(schoolId);

            var model = new AddStudentClassViewModel
            {
                Students = students,
                Classes  = classes
            };

            return(View(nameof(AddStudentClass), model));
        }
Example #2
0
        public async Task <IActionResult> AddStudentClass(AddStudentClassViewModel model)
        {
            await this.classService.AddStudentToClass(model.StudentId, model.ClassId);

            return(await Index());
        }