Example #1
0
 public async Task AddTestResult(CompleteTestResult item)
 {
     try
     {
         //item.Id = Guid.NewGuid().ToString();
         await _context.TestResults.InsertOneAsync(item).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         _logger.Warn($"Exception in repository {ex.ToString()}");
         throw ex;
     }
 }
Example #2
0
        public async Task <UpdateResult> UpdateTestResult(String id, CompleteTestResult newResult)
        {
            var filter = Builders <CompleteTestResult> .Filter.Eq(s => s.Id, id);

            var update = Builders <CompleteTestResult> .Update
                         .Set(s => s, newResult)
                         .CurrentDate(s => s.UpdatedOn);

            try
            {
                return(await _context.TestResults.UpdateOneAsync(filter, update).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                _logger.Warn($"Exception in repository {ex.ToString()}");
                throw ex;
            }
        }