public GetProgramsResponse GetPrograms() { GetProgramsResponse response = new GetProgramsResponse(); try { response.Programs = _programsRepository.GetPrograms().ToList(); } catch (Exception ex) { response.IsSuccessful = false; response.Errors.Add("An error has occurred while getting all programs!"); _logger.LogException(ex); } return(response); }
public CourseResponse GetCourseById(IdRequest request) { var response = new IdRequestValidator().Validate(request).ToResponse <CourseResponse>(); if (!response.IsSuccessful) { return(response); } try { response.Course = _coursesRepository.GetCourseById(request.Id); } catch (Exception ex) { response.IsSuccessful = false; response.Errors.Add("An error has occurred while getting the specific course!"); _logger.LogException(ex); } return(response); }