Exemple #1
0
        public async Task <IActionResult> Teacher()
        {
            var user = await GetCurrentUserAsync();

            if (user is TeacherAccount)
            {
                var sc                   = _schoolClasses.GetByTeacher(user.Id);
                var messagesIn           = _messages.GetForUserReceiving(user.Id, 0, MessagesToRead, out var isMoreIn);
                var messagesOut          = _messages.GetForUserSending(user.Id, 0, MessagesToRead, out var isMoreOut);
                var students             = _students.GetStudentsForSchoolClass(sc.Id);
                var assignmentsGraded    = _assignments.GetGradedForSchoolClassId(sc.Id);
                var assignmentsNotGraded = _assignments.GetNotGradedForSchoolClassId(sc.Id);

                var model = new ManageAccountModel()
                {
                    MessagesInbound      = messagesIn,
                    MessagesOutbound     = messagesOut,
                    Students             = students,
                    TeacherSchoolClass   = sc,
                    AssignmentsGraded    = assignmentsGraded,
                    AssignmentsNotGraded = assignmentsNotGraded,
                    IsMoreIn             = isMoreIn,
                    IsMoreOut            = isMoreOut,
                    Offset = MessagesToRead,
                    UserId = user.Id
                };

                return(View(model));
            }

            return(RedirectToAction("Error", "Home"));
        }