예제 #1
0
        public async Task <IActionResult> OnGet(int?simID)
        {
            if (simID == null)
            {
                return(NotFound());
            }

            StudentQuestions = await Context.StudentQuestions
                               .Include(q => q.Simulation)
                               .Include(q => q.Question)
                               .Where(q => q.SimulationID == simID &&
                                      q.UserID == UserManager.GetUserId(User))
                               .ToListAsync();

            StudentAssignment = Context.StudentAssignments
                                .SingleOrDefault(a => a.UserID == UserManager.GetUserId(User) &&
                                                 a.SimulationID == simID);


            if (StudentQuestions == null || StudentQuestions.Count() == 0 || StudentAssignment == null)
            {
                return(NotFound());
            }


            var isAuthorized = await AuthorizationService.AuthorizeAsync(User, StudentAssignment, Operations.ViewStudentAssignment);

            if (!isAuthorized.Succeeded)
            {
                return(Forbid());
            }

            return(Page());
        }
예제 #2
0
 public void UpdateStudentQuestionsList(StudentQuestions sq)
 {
     {
         using (var repository = new CommonRepository <StudentQuestions>())
         {
             repository.Update(sq);
         }
     }
 }