示例#1
0
        public DTO.SearchResult Search(bool isRKAdmin, Guid clientId, DTO.SearchFilterRestriction filter)
        {
            if (!isRKAdmin)
            {
                var appStore = applicationStoreRepository.GetByClientId(clientId);

                if (filter.StoreCode.IsEmpty())
                {
                    filter.StoreCode = appStore.StoreCode;
                }
                else if (appStore.StoreCode != filter.StoreCode)
                {
                    throw new ArgumentException("Usuário não possui permissão para realizar essa operação");
                }
            }

            var result = restrictionRepository.Search(filter);

            var restrictions = result.Results.Select(r => r.GetResult());

            return(new DTO.SearchResult(restrictions).SetResult(result));
        }