private async Task <(bool success, BadRequestError error)> IsRouteOwner(string path)
        {
            var userId =
                this.GetUserId();

            if (string.IsNullOrWhiteSpace(userId))
            {
                return(false, BadRequestError.UserNotFound);
            }

            BinaryFilterUnit pathFilter =
                new BinaryFilterUnit()
            {
                OperatorType = OperatorType.Equals,
                Unit1        = new ParameterFilterUnit()
                {
                    PropertyName = "Path",
                },
                Unit2 = new ConstFilterUnit()
                {
                    Value = path
                }
            };

            BinaryFilterUnit userIdFilter =
                new BinaryFilterUnit()
            {
                OperatorType = OperatorType.Equals,
                Unit1        = new ParameterFilterUnit()
                {
                    PropertyName = "OwnerId",
                },
                Unit2 = new ConstFilterUnit()
                {
                    Value = userId
                }
            };

            BinaryFilterUnit filter =
                new BinaryFilterUnit()
            {
                OperatorType = OperatorType.And,
                Unit1        = pathFilter,
                Unit2        = userIdFilter,
            };

            var routes =
                await
                _routeService.Get(1, 1, new SearchModel()
            {
                Filter = filter,
            });

            return
                (routes.Items.Count == 1
                                        ? (true, BadRequestError.None)
                                        : (false, BadRequestError.UserNotFound));
        }
        public async Task <PagingResult <T> > Get(int page, int pageSize, SearchModel filterUnit)
        {
            if (filterUnit != null)
            {
                if (filterUnit.Filter != null)
                {
                    BinaryFilterUnit binary =
                        new BinaryFilterUnit()
                    {
                        OperatorType = OperatorType.And,
                        Unit1        = DictRowFilter,
                        Unit2        = filterUnit.Filter,
                    };

                    filterUnit.Filter = binary;
                }
                else
                {
                    filterUnit.Filter = DictRowFilter;
                }
            }
            else
            {
                filterUnit =
                    new SearchModel()
                {
                    Filter = DictRowFilter
                };
            }

            var rows =
                await _dictionaryRowService.Get(page, pageSize, filterUnit);

            return(new PagingResult <T>()
            {
                Total = rows.Total,
                Items = rows.Items.Select(CreteT).ToArray()
            });
        }
        public DictionaryTypeServiceBase(IDictionaryRowService dictionaryRowService,
                                         IDictionaryService dictionaryService)
        {
            var className = typeof(T).Name;

            _dictionaryCode       = className.StartsWith("I") ? className.Substring(1) : className;
            _dictionaryRowService = dictionaryRowService;
            _dictionaryService    = dictionaryService;

            DictFilter =
                new BinaryFilterUnit()
            {
                Unit2 = new ParameterFilterUnit()
                {
                    PropertyName = "Code"
                },
                Unit1 = new ConstFilterUnit()
                {
                    Value = _dictionaryCode
                },
                OperatorType = OperatorType.Equals
            };

            DictRowFilter =
                new BinaryFilterUnit()
            {
                Unit2 = new ParameterFilterUnit()
                {
                    PropertyName = "DictionaryCode"
                },
                Unit1 = new ConstFilterUnit()
                {
                    Value = _dictionaryCode
                },
                OperatorType = OperatorType.Equals
            };
        }