public async Task <IKnowledgeHubResponse> GetCourseIframe(int courseId, LanguageType language = LanguageType.AR) { try { var knowledgeHubCourse = await _appDbContext.KnowledgeHubCourses.FirstOrDefaultAsync(x => x.Id == courseId); if (knowledgeHubCourse == null) { throw new ArgumentException("Invalid knowledgeHubCourseID: " + (object)courseId); } var iframe = new KnowledgeHubCourseIframe() { CourseName = language == LanguageType.EN? knowledgeHubCourse.NameEn: knowledgeHubCourse.NameAr, Iframe = language == LanguageType.EN ? knowledgeHubCourse.IframeUrlEn: knowledgeHubCourse.IframeUrlAr }; return(new KnowledgeHubResponse(iframe)); } catch (Exception e) { return(new KnowledgeHubResponse(e)); } }
private KnowledgeHubResponse(bool success, string message, KnowledgeHubCourseIframe view) : base(success, message) { CourseIframe = view; }
public KnowledgeHubResponse(KnowledgeHubCourseIframe view) : this(true, string.Empty, view) { }