2018-01-27 00:26:37 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Sieve.Models
|
|
|
|
|
{
|
2018-01-27 12:49:24 +01:00
|
|
|
|
public class SieveModel : ISieveModel
|
2018-01-27 00:26:37 +01:00
|
|
|
|
{
|
2018-01-27 06:20:57 +01:00
|
|
|
|
public string Filters { get; set; }
|
2018-01-27 00:26:37 +01:00
|
|
|
|
|
2018-01-27 06:20:57 +01:00
|
|
|
|
public string Sorts { get; set; }
|
2018-01-27 00:26:37 +01:00
|
|
|
|
|
|
|
|
|
[Range(1, Double.MaxValue)]
|
2018-01-27 06:20:57 +01:00
|
|
|
|
public int? Page { get; set; }
|
2018-01-27 00:26:37 +01:00
|
|
|
|
|
|
|
|
|
[Range(1, Double.MaxValue)]
|
2018-01-27 06:20:57 +01:00
|
|
|
|
public int? PageSize { get; set; }
|
|
|
|
|
|
|
|
|
|
|
2018-01-28 01:16:24 +01:00
|
|
|
|
public List<FilterTerm> FiltersParsed
|
2018-01-27 06:20:57 +01:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (Filters != null)
|
|
|
|
|
{
|
|
|
|
|
var value = new List<FilterTerm>();
|
|
|
|
|
foreach (var filter in Filters.Split(','))
|
|
|
|
|
{
|
|
|
|
|
value.Add(new FilterTerm(filter));
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-28 01:16:24 +01:00
|
|
|
|
public List<SortTerm> SortsParsed
|
2018-01-27 06:20:57 +01:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (Sorts != null)
|
|
|
|
|
{
|
|
|
|
|
var value = new List<SortTerm>();
|
|
|
|
|
foreach (var sort in Sorts.Split(','))
|
|
|
|
|
{
|
|
|
|
|
value.Add(new SortTerm(sort));
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-27 00:26:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|