public async Task AddLoan(MortgageDoc item) { try { await _context.Mortgages.InsertOneAsync(item); } catch (Exception ex) { // log or manage the exception throw ex; } }
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; } }