public async Task <OperationResult <Course> > GetCourseById(Guid courseId) { using (CourseLibraryContext context = new CourseLibraryContext(options)) { try { var result = await CoursesCompiledQueries.GetCourseById(context, courseId); if (result == null) { return(new FailedOperationResult <Course> { Code = ConstOperationCodes.COURSE_NOT_FOUND }); } return(new SuccessOperationResult <Course> { Result = result }); } catch (Exception e) { logger.Error($"error in course library context get course by id {e.Message} "); return(new FailedOperationResult <Course> { Code = ConstOperationCodes.FAILED_OPERATION, }); } } }
public async Task <bool> IsCourseExist(Guid courseId) { using (CourseLibraryContext context = new CourseLibraryContext(options)) { bool isCourseExist = await CoursesCompiledQueries.IsCourseExist(context, courseId); return(isCourseExist); } }