Ejemplo n.º 1
0
 public async Task AddLoan(MortgageDoc item)
 {
     try
     {
         await _context.Mortgages.InsertOneAsync(item);
     }
     catch (Exception ex)
     {
         // log or manage the exception
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public async Task <bool> UpdateLoan(Guid id, MortgageDoc account)
        {
            try
            {
                account.UpdatedOn = DateTime.Now;
                ReplaceOneResult actionResult = await _context.Mortgages.ReplaceOneAsync(a => a.Id.Equals(id),
                                                                                         account, new UpdateOptions { IsUpsert = true });

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