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(); }
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)); }