예제 #1
0
 public void TestDeleteExam()
 {
     // Act
     examService.DeleteExam(id);
     // Assert
     Assert.AreEqual(true, boolDelete);
 }
예제 #2
0
        public IActionResult DeleteStudent(int?examId)
        {
            if (examId == null)
            {
                return(BadRequest());
            }

            try
            {
                _logger.LogInformation("Deleting exam by Id from the database.");
                examService.DeleteExam(examId);
                _logger.LogInformation($"Exam by ID {examId} has been deleted.");

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong: {ex}");
                return(StatusCode(500, "Internal server error."));
            }
        }