mirror of
				https://github.com/Biarity/Sieve.git
				synced 2025-10-31 16:58:55 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			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;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |