Ejemplo n.º 1
0
        public IList <T> GetAllByConditionsAndSort <TKey>(Expression <Func <T, bool> > expression, Expression <Func <T, TKey> > sort, Constants.SortTypes sortType)
        {
            IList <T> entities = this.GetQueryableByConditionsAndSort <TKey>(expression, sort, sortType).ToList();

            return(entities);
        }
Ejemplo n.º 2
0
        public T GetFirstByConditionsAndSort <TKey>(Expression <Func <T, bool> > expression, Expression <Func <T, TKey> > sort, Constants.SortTypes sortType)
        {
            T entity = this.GetQueryableByConditionsAndSort <TKey>(expression, sort, sortType).FirstOrDefault();

            return(entity);
        }
Ejemplo n.º 3
0
        private IQueryable <T> GetQueryableByConditionsAndSort <TKey>(Expression <Func <T, bool> > expression, Expression <Func <T, TKey> > sort, Constants.SortTypes sortType)
        {
            IQueryable <T> entities = this.GetQueryableByConditions(expression);

            switch (sortType)
            {
            case Constants.SortTypes.Asc:
                entities = this._mongoCollection.AsQueryable().Where(expression).OrderBy(sort);
                break;

            case Constants.SortTypes.Desc:
                entities = this._mongoCollection.AsQueryable().Where(expression).OrderByDescending(sort);
                break;

            default:
                throw new ArgumentException();
            }

            return(entities);
        }
Ejemplo n.º 4
0
 public T GetFirstByConditionsAndSort <TKey>(Expression <Func <T, bool> > expression, Expression <Func <T, TKey> > sort, Constants.SortTypes sortType)
 {
     return(this._repository.GetFirstByConditionsAndSort <TKey>(expression, sort, sortType));
 }