Exemplo n.º 1
0
        public bool GetSingle <T>(string prefix, IList <T> query) where T : class, IDataItem
        {
            prefix += ":";
            if (Search.StartsWith(prefix))
            {
                if (int.TryParse(Search.Substring(prefix.Length), out int id))
                {
                    T item = DataSession.Single <T>(id);
                    if (item != null)
                    {
                        query.Add(item);
                    }
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        public bool GetMultiple <T>(string prefix, IList <T> query, Func <int, Expression <Func <T, bool> > > search) where T : class, IDataItem
        {
            prefix += ":";
            if (Search.StartsWith(prefix))
            {
                if (int.TryParse(Search.Substring(prefix.Length), out int id))
                {
                    IList <T> items = DataSession.Query <T>().Where(search(id)).ToList();
                    foreach (T i in items)
                    {
                        query.Add(i);
                    }
                }

                return(true);
            }

            return(false);
        }