Skip to content

Instantly share code, notes, and snippets.

@lonnkvist
Created May 7, 2019 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lonnkvist/5ee3399538d7bf4645699719959bda14 to your computer and use it in GitHub Desktop.
Save lonnkvist/5ee3399538d7bf4645699719959bda14 to your computer and use it in GitHub Desktop.
[HttpGet]
public RestResultBase Get(ContentReference id, string query, ContentReference referenceId, ContentReference[] references, string[] typeIdentifiers, bool? allLanguages, IEnumerable<SortColumn> sortColumns, ItemRange range)
{
ContentQueryParameters parameters1 = new ContentQueryParameters();
parameters1.ReferenceId = referenceId;
parameters1.References = references;
parameters1.AllLanguages = allLanguages.Value;
parameters1.TypeIdentifiers = typeIdentifiers;
parameters1.SortColumns = sortColumns;
parameters1.Range = range;
parameters1.AllParameters = base.ControllerContext.HttpContext.Request.QueryString;
parameters1.CurrentPrincipal = PrincipalInfo.CurrentPrincipal;
parameters1.PreferredCulture = allLanguages.Value ? null : this._languageResolver.GetPreferredCulture();
ContentQueryParameters queryParameters = parameters1;
if (string.IsNullOrEmpty(query) && ContentReference.IsNullOrEmpty(id))
{
return base.Rest(new object[0]);
}
if (string.IsNullOrEmpty(query))
{
return this.GetContent(id, queryParameters);
}
QueryRange<IContent> range2 = this.GetQuery(query, queryParameters).ExecuteQuery(queryParameters);
if ((range2 == null) || (range2.Items == null))
{
return new RestStatusCodeResult((HttpStatusCode) HttpStatusCode.NotFound);
}
IEnumerable<StructureStoreContentDataModel> data = this.CreateStoreModels((IEnumerable<IContent>) range2.Items, queryParameters);
RestResult result1 = base.Rest(data);
result1.Range = range2.Range;
return result1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment