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); }
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); }
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); }
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)); }