Example #1
0
 private static async Task StoreData <T>(DBEntity <T> data) where T : class
 {
     var client   = new MongoClient();
     var db       = client.GetDatabase("diary");
     var products = db.GetCollection <BsonDocument>("products");
     var doc      = data.ToBsonDocument();
     await products.InsertOneAsync(doc);
 }
Example #2
0
        public static async Task <BarcodeInfo> FetchBarcode(string barcode)
        {
            //4607083213592
            var info = await GetBarcodeInfo(barcode);

            var data = new DBEntity <BarcodeInfo>(info);

            await StoreData(data);

            return(info);
        }