public HttpResponseMessage ParHint(int langId, int siteLangId, int uniqueId, int dbIndex, String toPar = "") { var content = WebApisRequest.Hint(uniqueId: uniqueId, dbIndex: dbIndex, toPar: toPar); var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Headers.Add("Access-Control-Allow-Origin", "*"); response.Headers.Add("Access-Control-Allow-Methods", "GET"); response.Headers.Add("Access-Control-Allow-Headers", "*"); response.Content = new StringContent(content, Encoding.UTF8, "text/html"); return(response); }
public HttpResponseMessage ParHint(int langId, int siteLangId, string docNumber, string toPar = "", string domain = "") { var baseUrl = HttpContext.Current.Request.Url.AbsoluteUri; baseUrl = baseUrl.Substring(0, baseUrl.IndexOf("/api")); var response = this.Request.CreateResponse(HttpStatusCode.OK); var content = String.Empty; if (domain.IsIn(StringComparison.InvariantCultureIgnoreCase, "bgtooltip")) { ChangeLangCulture(langId); var parts = docNumber.Split('_'); content = WebApisRequest.Hint(code: parts[1], @base: parts[0], toPar: toPar); if (String.IsNullOrEmpty(content)) { content = WebApisDocumentLink.CreateApisUrl(code: parts[1], @base: parts[0]); } } else { var actualLanguageId = GetAvailableLanguageIdForDocument(docNumber, langId); ChangeLangCulture(actualLanguageId); var d = Doc.GetParText( "celex", docNumber, toPar, actualLanguageId, null, actualLanguageId, false, false, true, true); content = d.Text; content = RedirectCelexAnchorsToEurocases(content, baseUrl, actualLanguageId); if (!String.IsNullOrEmpty(content)) { content = $"<div class='eurocases-hint-wrapper'><p class='hint-header'>InterLex</p>{content}</div>"; } if (String.IsNullOrEmpty(content)) { content = Doc.CreateEurLexLink(docNumber, actualLanguageId); } } response.Headers.Add("Access-Control-Allow-Origin", "*"); response.Headers.Add("Access-Control-Allow-Methods", "GET"); response.Headers.Add("Access-Control-Allow-Headers", "*"); response.Content = new StringContent(content, Encoding.UTF8, "text/html"); return(response); }