public async Task DeleteGradeAsync_HappyPath(int id) { OneTimeSetUp(); await _gradesService.DeleteAsync(TestTeacherDBId); var expected = 0; _gradesRepositoryMock.Object.AllAsNoTracking().Count().Should().Be(expected); }
public async Task <IActionResult> DeleteGrade(GradeModifyInputModel inputModel, string onSubmitAction) { if (onSubmitAction.IsNullOrEmpty() || onSubmitAction == "Cancel") { return(RedirectToAction("SubjectsList", "Subjects", new { area = string.Empty })); } try { await _gradesService.DeleteAsync(inputModel.Id); return(RedirectToAction("SubjectsList", "Subjects", new { area = string.Empty })); } catch (Exception e) { _logger.LogError(e, $"An exception occured during student DELETE operation for grade with id {inputModel.Id}. Ex: {e.Message}"); return(RedirectToAction("Error", "Home")); } }