PaginationDsM.cs 1019 Bytes
namespace MapsModels.DsModels
{
    public class PaginationDsM
    {
        public const string ASC = "ASC";
        public const string DESC = "DESC";
        public int from { get; set; }
        public int per_page;
        public string sort { get; set; }
        public string filter {get; set;}
        public int perPage{
            get{
                if(per_page == 0){
                    return 25;
                }
                return per_page;
            } 
            set{
                per_page = value;
            } 
        }
        public string orderType(){
            string orderType = null;
            if(sort != null){
               if(sort.StartsWith("-")){
                    sort = sort.Substring(1);
                    orderType = DESC;
                } else {
                    orderType = ASC;
                }
                
                sort = char.ToUpper(sort[0]) + sort.Substring(1);
            }
            
            return orderType;
        }
    }
}