Пример #1
0
 public async void InsertFileContent(CSVSalesFile salesFile)
 {
     try
     {
         await _mongoCollection.InsertOneAsync(salesFile);
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Could not save MongoDB document", ex);
     }
 }
Пример #2
0
        public CSVSalesFile GetById(string id)
        {
            try
            {
                var filter_id = Builders <CSVSalesFile> .Filter.Eq("_id", id);

                CSVSalesFile salesFile = _mongoCollection.Find(filter_id).FirstOrDefault();
                return(salesFile);
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Could not find MongoDB document", ex);
            }
        }