public async Task UpdateStudentGrade_Valid_Ok() { var enrollmentId = 45; var obj = new UpdateGrade { Grade = (decimal?)27.8 }; await _enrollmentLogic.UpdateStudentGrade(enrollmentId, obj); var actual = await _enrollmentRepository.GetById(enrollmentId); Assert.AreEqual(actual.Grade, obj.Grade); }
public async Task <IActionResult> UpdateGrade(int enrollmentId, [FromBody] UpdateGrade updateGrade) { try { if (!ModelState.IsValid) { return(ValidationProblem("Invalid parameters")); } await _enrollmentLogic.UpdateStudentGrade(enrollmentId, updateGrade); return(NoContent()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }