public static IEnumerable<ContentHead> GetCrossLinksFrom(string pageArea, string order = "CrossLinkDisplayOrder", int top = 0, string[] kinds = null, bool parseContent = false, string[] pageAreaFallBacks = null) { SiteService site = new SiteService(); return site.GetCrossLinksFrom(pageArea, order, top, kinds, parseContent, pageAreaFallBacks); }
/// <summary> /// Gets Quiz FirstOrDefault() based on pageAREA /// </summary> /// <param name="pageArea"></param> /// <returns></returns> public static IHtmlString Quiz(string pageArea) { Func<ContentHead, HelperResult> template = (quiz) => { string templatePath = System.Web.HttpContext.Current.Request.MapPath("~/box_templates/QUIZ.cshtml"); string schemaTemplate = System.IO.File.ReadAllText(templatePath, Encoding.Default); bool alreadyVoted = true; if (HttpContext.Current.Request.Cookies["QUIZ_" + quiz.ContentUId] == null) alreadyVoted = false; quiz.CONTENT["alreadyVoted"] = alreadyVoted; string outputQuiz = RazorEngine.Razor.Parse(schemaTemplate, quiz); return new HelperResult(w => w.Write(outputQuiz)); }; string str = ""; SiteService site = new SiteService(); var quizContent = site.GetCrossLinksFrom(pageArea, null, 1, new string[] { "QUIZ" }, true).FirstOrDefault(); if (quizContent != null) str = template(quizContent).ToString(); return new HtmlString(str); }