Ejemplo n.º 1
0
 public async Task AddTransaction(TransactionDoc item)
 {
     try
     {
         await _context.Transactions.InsertOneAsync(item);
     }
     catch (Exception ex)
     {
         // log or manage the exception
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public async Task <bool> UpdateTransaction(Guid id, TransactionDoc account)
        {
            try
            {
                ReplaceOneResult actionResult = await _context.Transactions.ReplaceOneAsync(n => n.Id.Equals(id),
                                                                                            account, new UpdateOptions { IsUpsert = true });

                return(actionResult.IsAcknowledged && actionResult.ModifiedCount > 0);
            }
            catch (Exception ex)
            {
                // log or manage the exception
                throw ex;
            }
        }