public async Task <List <OrderDetails> > FindAllAsync(Expression <Func <OrderDetails, bool> > predicate = null) { var filter = MongoHelpers.GetDocumentFilter(predicate); var details = (await _orderDetailsCollection.FindAsync(filter)).ToList(); return(details); }
public async Task <List <Publisher> > FindAllAsync(Expression <Func <Publisher, bool> > predicate = null) { var filter = MongoHelpers.GetDocumentFilter(predicate); var publishers = (await _publishersCollection.FindAsync(filter)).ToList(); return(publishers); }
public async Task <OrderDetails> FindSingleAsync(Expression <Func <OrderDetails, bool> > predicate) { var filter = MongoHelpers.GetDocumentFilter(predicate); var details = (await _orderDetailsCollection.FindAsync(filter)).FirstOrDefault(); return(details); }
public async Task <Publisher> FindSingleAsync(Expression <Func <Publisher, bool> > predicate) { var filter = MongoHelpers.GetDocumentFilter(predicate); var publisher = (await _publishersCollection.FindAsync(filter)).FirstOrDefault(); return(publisher); }
public async Task <List <Product> > FindAllAsync(Expression <Func <Product, bool> > predicate = null) { var filter = MongoHelpers.GetDocumentFilter(predicate); var games = (await _productsCollection.FindAsync(filter)).ToList(); return(games); }
public async Task UpdateKeyAsync(string productId, string key) { var existingProduct = await GetById(productId); var oldValueInstance = existingProduct.Clone(); existingProduct.Key = key; var filter = MongoHelpers.GetDocumentFilter <Product>(p => p.Id == productId); await _productsCollection.ReplaceOneAsync(filter, existingProduct); var entry = new LogEntry <Product>(Operation.Update, oldValueInstance, existingProduct); _logger.Log(entry); }
public async Task UpdateUnitsInStockAsync(string key, short unitsInStock) { var existingProduct = await FindSingleAsync(p => p.Key == key); var oldValueInstance = existingProduct.Clone(); existingProduct.UnitsInStock = unitsInStock; var filter = MongoHelpers.GetDocumentFilter <Product>(p => p.Key == key); await _productsCollection.ReplaceOneAsync(filter, existingProduct); var entry = new LogEntry <Product>(Operation.Update, oldValueInstance, existingProduct); _logger.Log(entry); }
public async Task <Order> FindSingleAsync(Expression <Func <Order, bool> > predicate) { var filter = MongoHelpers.GetDocumentFilter(predicate); var order = (await _ordersCollection.FindAsync(filter)).FirstOrDefault(); if (order == null) { return(null); } await SetupDetails(new[] { order }); await SetupGameDetails(order.Details); return(order); }