Пример #1
0
        public IActionResult EditCheckedAssignment(int assignmentId, string userId)
        {
            EditCheckedUserAssignmentViewModel viewModel = this.assignmentsService.GetCheckedBy <EditCheckedUserAssignmentViewModel>(assignmentId, userId);

            viewModel.WorkFiles     = this.filesService.GetAllUserSubmittedFilesForAssignment <FileAssignmentViewModel>(assignmentId, userId);
            viewModel.ResourceFiles = this.filesService.GetAllByUserAndAssignment <FileAssignmentViewModel>(assignmentId, userId);

            viewModel.InputModel = this.assignmentsService.GetCheckedBy <EditCheckedAssignmentInputModel>(assignmentId, userId);

            viewModel.AssignmentId = assignmentId;
            return(this.View(viewModel));
        }
Пример #2
0
        public async Task <IActionResult> EditCheckedAssignment(EditCheckedUserAssignmentViewModel viewModel, string userId)
        {
            try
            {
                viewModel.InputModel.AssignmentId = viewModel.AssignmentId;
                viewModel.InputModel.UserId       = userId;
                await this.assignmentsService.UpdateCheckedAsync(viewModel.InputModel);

                this.TempData["EditedCheckedAssignment"] = "Successfully editted marked Assignment";

                return(this.RedirectToAction("AllCheckedUsersForAssignment", "Assignments", new { Id = viewModel.AssignmentId }));
            }
            catch (Exception e)
            {
                viewModel.InputModel = this.assignmentsService.GetCheckedBy <EditCheckedAssignmentInputModel>(viewModel.AssignmentId, userId);

                viewModel.ResourceFiles = this.filesService.GetAllByUserAndAssignment <FileAssignmentViewModel>(viewModel.AssignmentId, userId);
                viewModel.WorkFiles     = this.filesService.GetAllByUserAndAssignment <FileAssignmentViewModel>(viewModel.AssignmentId, userId);

                this.TempData["ErrorPoints"] = e.Message;
                return(this.RedirectToAction("EditCheckedAssignment", "Assignments", new { AssignmentId = viewModel.AssignmentId, UserId = userId }));
            }
        }