public async Task Add(AssetPriceModel price) { var model = new MongoAssetPriceModel { Price = price }; await _collection.InsertOneAsync(model); _logger.LogTrace($"Price added: {price}"); }
public IHttpActionResult InsertAssetPriceDetails(AssetPriceModel model) { AssetPriceFeed assetPrice = new AssetPriceFeed { Address = model.Address, Ticker = model.Ticker, AssetPrice = model.AssetPrice, TransactionDate = model.TransactionDate, AssetType = model.AssetType }; edisRepo.FeedDataForAssetPrices(assetPrice, (AssetTypes)Int32.Parse(model.AssetType)); return(Ok()); }
public async Task Update(AssetPriceModel price) { var model = _collection.AsQueryable() .FirstOrDefault(m => (m.Price != null) && (m.Price.Isin == price.Isin)); if (model == null) { _logger.LogWarning($"Price not found: {price}"); return; } model.Price = price; await _collection.ReplaceOneAsync(m => m.Id == model.Id, model); _logger.LogTrace($"Price updated: {price}"); }