public async Task DeleteAbsenceAsync(int id) { OneTimeSetUp(); await _absencesService.DeleteAsync(TestTeacherDBId); var expected = 0; _absencesRepositoryMock.Object.AllAsNoTracking().Count().Should().Be(expected); }
public async Task <IActionResult> DeleteAbsence(AbsenceModifyInputModel inputModel, string onSubmitAction) { if (onSubmitAction.IsNullOrEmpty() || onSubmitAction == "Cancel") { return(RedirectToAction("SubjectsList", "Subjects", new { area = string.Empty })); } try { await _absencesService.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 absence with id {inputModel.Id}. Ex: {e.Message}"); return(RedirectToAction("Error", "Home")); } }