コード例 #1
0
        public async Task EvaluateAsync(EvaluateInputModel inputModel)
        {
            SubmissionDTO submission = await service.GetByCompositeKeysAsync(inputModel.assignmentId, inputModel.studentId);

            if (submission == null)
            {
                throw new Exception();
            }

            submission.Grade = (byte)inputModel.Grade;
            await service.SaveChangesAsync();
        }
コード例 #2
0
        public async Task <ActionResult> Evaluate(EvaluateInputModel inputModel)
        {
            if (ModelState.IsValid)
            {
                await _service.EvaluateAsync(inputModel);

                return(RedirectToAction("Student", "Mentors", new { id = inputModel.studentId }));
            }

            EvaluateViewModel viewModel = new EvaluateViewModel
            {
                Submission = await _service.GetSubmissionAsync(inputModel.assignmentId, inputModel.studentId),
                Grade      = inputModel.Grade
            };

            return(View(viewModel));
        }