tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
PaginatableResult.cs
Go to the documentation of this file.
1using System;
2using System.Diagnostics.CodeAnalysis;
3using System.Linq;
4
5using Microsoft.AspNetCore.Mvc;
6
8{
13 public sealed class PaginatableResult<TModel>
14 {
18 [MemberNotNullWhen(true, nameof(Results))]
19 [MemberNotNullWhen(false, nameof(EarlyOut))]
20 public bool Valid => EarlyOut == null;
21
25 public IOrderedQueryable<TModel>? Results { get; }
26
30 public IActionResult? EarlyOut { get; }
31
36 public PaginatableResult(IOrderedQueryable<TModel> results)
37 {
38 Results = results ?? throw new ArgumentNullException(nameof(results));
39 }
40
45 public PaginatableResult(IActionResult earlyOut)
46 {
47 EarlyOut = earlyOut ?? throw new ArgumentNullException(nameof(earlyOut));
48 }
49 }
50}
PaginatableResult(IActionResult earlyOut)
Initializes a new instance of the PaginatableResult<TModel> class.
bool Valid
Whether or not the PaginatableResult<TModel> is valid.
IActionResult? EarlyOut
An IActionResult to return immediately.
PaginatableResult(IOrderedQueryable< TModel > results)
Initializes a new instance of the PaginatableResult<TModel> class.
IOrderedQueryable< TModel >? Results
The IOrderedQueryable<T> TModel results.