Пример #1
0
        public static string ToQueryParams(this UserFilter filter)
        {
            string queryParams = string.Empty;

            if (!string.IsNullOrWhiteSpace(filter.Search))
            {
                queryParams = QueryParamsHelper.AddParams(queryParams, $"search={filter.Search}");
            }

            if (filter.Users?.Any() ?? false)
            {
                foreach (var userId in filter.Users)
                {
                    queryParams = QueryParamsHelper.AddParams(queryParams, $"users={userId}");
                }
            }


            return(queryParams);
        }
Пример #2
0
        public static string ToQueryParams(this ProposalFilter filter)
        {
            string queryParams = string.Empty;

            if (!string.IsNullOrWhiteSpace(filter.Title))
            {
                queryParams = QueryParamsHelper.AddParams(queryParams, $"title={filter.Title}");
            }

            if (filter.Date.HasValue)
            {
                queryParams = QueryParamsHelper.AddParams(queryParams, $"date={filter.Date.Value.ToString("yyyy-MM-dd")}");
            }

            if (filter.IsActive.HasValue)
            {
                queryParams = QueryParamsHelper.AddParams(queryParams, $"isActive={filter.IsActive.Value}");
            }

            return(queryParams);
        }
Пример #3
0
        public static string ToQueryParams(this DeviceFilter filter)
        {
            string queryParams = string.Empty;

            if (filter.Users?.Any() ?? false)
            {
                foreach (var userId in filter.Users)
                {
                    queryParams = QueryParamsHelper.AddParams(queryParams, $"users={userId}");
                }
            }

            if (!string.IsNullOrWhiteSpace(filter.OperativeSystem))
            {
                queryParams = QueryParamsHelper.AddParams(queryParams, $"operativeSystem={filter.OperativeSystem}");
            }

            if (!string.IsNullOrWhiteSpace(filter.Name))
            {
                queryParams = QueryParamsHelper.AddParams(queryParams, $"name={filter.Name}");
            }

            return(queryParams);
        }