Skip to content

Commit

Permalink
Adding support for paged results
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuck committed Dec 10, 2020
1 parent ad6ff26 commit ac936ae
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
30 changes: 30 additions & 0 deletions src/YuckQi.Domain/RequestResults/Page.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Collections.Generic;
using YuckQi.Domain.Entities.Abstract;

namespace YuckQi.Domain.RequestResults
{
public class Page<TEntity, TKey> where TEntity : class, IEntity<TKey> where TKey : struct
{
#region Properties

public IReadOnlyCollection<TEntity> Items { get; }
public int PageNumber { get; }
public int PageSize { get; }
public int TotalCount { get; }

#endregion


#region Constructors

public Page(IReadOnlyCollection<TEntity> items, int page, int rows, int total)
{
Items = items ?? new List<TEntity>();
PageNumber = page;
PageSize = rows;
TotalCount = total;
}

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;

namespace YuckQi.Domain
namespace YuckQi.Domain.RequestResults
{
public class Result
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace YuckQi.Domain
namespace YuckQi.Domain.RequestResults
{
public readonly struct ResultCode
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace YuckQi.Domain
namespace YuckQi.Domain.RequestResults
{
public class ResultDetail
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace YuckQi.Domain
namespace YuckQi.Domain.RequestResults
{
public enum ResultType
{
Expand Down
2 changes: 1 addition & 1 deletion src/YuckQi.Domain/YuckQi.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Company />
<Version>0.0.3</Version>
<Version>0.1.0</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

Expand Down

0 comments on commit ac936ae

Please sign in to comment.