using System.Collections.Generic; namespace Luticate2.Auth.Dbo.Pagination { public class LuFilterDbo { public string Query { get; set; } public IDictionary Filters { get; set; } public string GetFilterString(string key, string defaultValue) { if (!Filters.ContainsKey(key)) { return defaultValue; } return Filters[key]; } public bool? GetFilterBool(string key, bool? defaultValue) { var value = GetFilterString(key, "").ToLower(); if (value == "true") { return true; } if (value == "false") { return false; } return defaultValue; } public int? GetFilterInt(string key, int? defaultValue) { int v; if (int.TryParse(GetFilterString(key, ""), out v)) { return v; } return defaultValue; } public double? GetFilterFloat(string key, double? defaultValue) { double v; if (double.TryParse(GetFilterString(key, ""), out v)) { return v; } return defaultValue; } } }