Skip to content

Commit

Permalink
Improve the Pager extensions (#15617)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Mar 28, 2024
1 parent 816cf84 commit 8ebf8e3
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace OrchardCore.DisplayManagement;
public static class ShapeFactoryExtensions
{
public static ValueTask<IShape> PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount)
=> _shapeFactory.CreateAsync("Pager", Arguments.From(new
=> _shapeFactory.CreateAsync(nameof(Pager), Arguments.From(new
{
pager.Page,
pager.PageSize,
Expand All @@ -17,11 +17,11 @@ public static ValueTask<IShape> PagerAsync(this IShapeFactory _shapeFactory, Pag

public static async ValueTask<IShape> PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount, RouteData routeData)
{
dynamic pagerShape = await _shapeFactory.PagerAsync(pager, totalItemCount);
var pagerShape = await _shapeFactory.PagerAsync(pager, totalItemCount);

if (routeData != null)
{
pagerShape.RouteData(routeData);
pagerShape.Properties[nameof(RouteData)] = routeData;
}

return pagerShape;
Expand All @@ -31,7 +31,7 @@ public static ValueTask<IShape> PagerAsync(this IShapeFactory _shapeFactory, Pag
=> _shapeFactory.PagerAsync(pager, totalItemCount, routeValues == null ? null : new RouteData(routeValues));

public static ValueTask<IShape> PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager)
=> _shapeFactory.CreateAsync("PagerSlim", Arguments.From(new
=> _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new
{
pager.Before,
pager.After,
Expand All @@ -40,7 +40,7 @@ public static ValueTask<IShape> PagerSlimAsync(this IShapeFactory _shapeFactory,

public static async ValueTask<IShape> PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager, IDictionary<string, string> values)
{
dynamic shape = await _shapeFactory.CreateAsync("PagerSlim", Arguments.From(new
var shape = await _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new
{
pager.Before,
pager.After,
Expand All @@ -49,7 +49,7 @@ public static async ValueTask<IShape> PagerSlimAsync(this IShapeFactory _shapeFa

if (values != null && values.Count > 0)
{
shape.UrlParams(values);
shape.Properties["UrlParams"] = values;
}

return shape;
Expand Down

0 comments on commit 8ebf8e3

Please sign in to comment.