public void DeleteMany(Expression <Func <TEntity, bool> > predicate, bool autoSave = false) { var entities = IAsyncCursorSourceExtensions.ToList <TEntity>(GetMongoQueryable() .Where(predicate)); DeleteMany(entities, autoSave); }
public List <TEntity> GetList(Expression <Func <TEntity, bool> > predicate, bool includeDetails = true) { var query = GetMongoQueryable(); return(IAsyncCursorSourceExtensions.ToList(query .Where(predicate))); }
public List <EventType> GetEventTypes() { var collection = _dbContext.GetCollection <EventType>("tiposEvento"); return(IAsyncCursorSourceExtensions.ToList((from e in collection.AsQueryable() select e))); }
public List <Season> GetSeasons() { var seasons = from e in Collection.AsQueryable() select e; return(IAsyncCursorSourceExtensions.ToList(seasons)); }
public List <TResult> Aggregate <TResult, TID>(FilterDefinition <TEntity> filter, Expression <Func <TEntity, TID> > id, Expression <Func <IGrouping <TID, TEntity>, TResult> > group, Expression <Func <TEntity, object> > sortExp = null, SortType sortType = 0, int limit = 0, int skip = 0, ReadPreference readPreference = null) { if (filter == null) { filter = Filter.Empty; } IAggregateFluent <TResult> fluent2 = IAggregateFluentExtensions.Group(CreateAggregate(filter, CreateSortDefinition(sortExp, sortType), readPreference), id, group); if (skip > 0) { fluent2 = fluent2.Skip(skip); } if (limit > 0) { fluent2 = fluent2.Limit(limit); } return(IAsyncCursorSourceExtensions.ToList(fluent2)); }
public IEnumerable <PostEvent> GetPostEvents(string type, DateTime ini, DateTime end) { var postEventsCollection = IAsyncCursorSourceExtensions.ToList((from e in _dbContext.GetCollection <PostEvent>("postEventos").AsQueryable() where e.IniDate >= ini && e.IniDate <= end select e).OrderByDescending(e => e.IniDate)); /* Add station class to each postEvent */ foreach (var postEvent in postEventsCollection) { postEvent.Station = GetStation(postEvent.StationId); } if (!string.IsNullOrEmpty(type)) { return(postEventsCollection.FindAll(e => e.Type.Equals(type))); } return(postEventsCollection); }
public async Task <IEnumerable <Album> > GetFavoriteAlbums(int userId) { IEnumerable <Entities.Album> favoriteAlbums = null; var cl = _db.GetCollection <FavoriteAlbum>("FavoriteAlbum").AsQueryable <FavoriteAlbum>(); IEnumerable <FavoriteAlbum> favoriteAlbumsResult = IAsyncCursorSourceExtensions.ToList(cl); if (favoriteAlbumsResult != null) { favoriteAlbums = favoriteAlbumsResult.Select(r => new Entities.Album { FavoriteAlbumId = Convert.ToInt32(r.Id), Name = r.Name, Artist = r.Artist, Url = r.Url }); } return(favoriteAlbums); }
public IEnumerable <TModel> FindBy(Expression <Func <TModel, bool> > predicate) { return(IAsyncCursorSourceExtensions.ToList(this.InternalCollection .AsQueryable() .Where(predicate))); }