public async Task <IActionResult> Delete(int id) { using (var logger = _loggerManager.CreateLogger()) { try { if (!ModelState.IsValid) { return(BadRequest()); } var studentCrsDeleted = await _studentCourseService.Delete(id); if (studentCrsDeleted) { logger.LogInformation($"Student {id} is deleted"); return(Ok()); } return(StatusCode(500)); } catch (Exception ex) { logger.LogError($"Something happend while deleting studentCrs {id}", ex); return(StatusCode(500)); } } }
public async Task <IActionResult> DeleteStudentCourse(long id) { if (id <= 0) { return(BadRequest()); } try { await _studentCourseService.Delete(id); return(Ok()); } catch (Exception ex) { return(NotFound(new { Error = "Error to delete course" })); } }