Sieve/Sieve/Models/SieveModel.cs
2018-01-27 15:20:57 +10:00

62 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Sieve.Models
{
public class SieveModel
{
public string Filters { get; set; }
public string Sorts { get; set; }
[Range(1, Double.MaxValue)]
public int? Page { get; set; }
[Range(1, Double.MaxValue)]
public int? PageSize { get; set; }
public List<FilterTerm> FilterParsed
{
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> SortParsed
{
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;
}
}
}
}
}