Sieve/Sieve/Models/SieveModel.cs

62 lines
1.5 KiB
C#
Raw Normal View History

2018-01-27 00:26:37 +01:00
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Sieve.Models
{
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; }
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;
}
}
}
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
}
}