public override string GetLeaCode(LeaCodeRequest request) { if (!this.httpContextItemsProvider.Contains(httpContextKey)) return null; return this.httpContextItemsProvider.GetValue(httpContextKey) as string; }
protected override string HandleRequest(LeaCodeRequest request) { var id = int.Parse(GetLeaCode(request)); //actually returns the id not the code var result = this.idCodeService.Get(IdCodeRequest.Create(id)); if (result != null) return result.Code; throw new LocalEducationAgencyNotFoundException("The local education agency " + id + " could not be found for request to " + this.httpRequestProvider.Url); }
public override string GetLeaCode(LeaCodeRequest request) { if (this.httpRequestProvider.Url == null) return null; var requestUrl = this.httpRequestProvider.Url.ToString(); string requestBase = requestUrlBaseProvider.GetRequestUrlBase(HttpContext.Current.Request.RequestContext.HttpContext.Request); string requestRelativeUrl = requestUrl.Replace(requestBase, string.Empty); // Try to extract the LEA name from the root of the virtual path string code; if (TryGetCodeFromUrl(requestRelativeUrl, out code)) return code; return null; }
public override string GetLeaCode(LeaCodeRequest request) { if (HttpContext.Current.Request.ContentType.ToLowerInvariant() == "application/json") { var bytes = new byte[HttpContext.Current.Request.InputStream.Length]; HttpContext.Current.Request.InputStream.Position = 0; HttpContext.Current.Request.InputStream.Read(bytes, 0, bytes.Length); HttpContext.Current.Request.InputStream.Position = 0; var requestContext = Encoding.ASCII.GetString(bytes); if (!string.IsNullOrEmpty(requestContext)) { var requestArray = Newtonsoft.Json.Linq.JObject.Parse(requestContext); if (requestArray[requestItemKey] != null) return (string) requestArray[requestItemKey]; } } return null; }
public override string GetLeaCode(LeaCodeRequest request) { if (EdFiDashboardContext.Current == null) return null; return EdFiDashboardContext.Current.LocalEducationAgency; }