Skip to content

Commit 40f1762

Browse files
authored
Romanchuk/Add default size to size filter (#761)
* Some changes to size filter * Сheck negative values was added ))
1 parent 73a64fc commit 40f1762

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

OutOfSchool/OutOfSchool.WebApi/Models/SizeFilter.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
/// </summary>
66
public class SizeFilter
77
{
8+
private const int DefaultSize = 8;
89
private const int MaxSize = 100;
910

10-
private int size = 10;
11+
private int size = DefaultSize;
1112

1213
/// <summary>
1314
/// Gets or sets the amount of entities to take from collection.
@@ -16,6 +17,14 @@ public int Size
1617
{
1718
get => size;
1819

19-
set => size = (value > MaxSize) ? MaxSize : value;
20+
set
21+
{
22+
size = value switch
23+
{
24+
<= 0 => DefaultSize,
25+
> MaxSize => MaxSize,
26+
_ => value
27+
};
28+
}
2029
}
2130
}

0 commit comments

Comments
 (0)