Esempio n. 1
0
        public async Task <List <SendView> > SearchSendsAsync(string query, Func <SendView, bool> filter = null,
                                                              List <SendView> sends = null, CancellationToken ct = default)
        {
            var results = new List <SendView>();

            if (query != null)
            {
                query = query.Trim().ToLower();
            }
            if (query == string.Empty)
            {
                query = null;
            }
            if (sends == null)
            {
                sends = await _sendService.GetAllDecryptedAsync();
            }

            ct.ThrowIfCancellationRequested();
            if (filter != null)
            {
                sends = sends.Where(filter).ToList();
            }

            ct.ThrowIfCancellationRequested();
            if (!IsSearchable(query))
            {
                return(sends);
            }

            return(SearchSendsBasic(sends, query));
        }