public CloseEvent SaveCloseEvent(CloseEvent closeEvent, IDbTransaction tx) { const string query = @" insert into dbo.ContractEvents (event_type, contract_id, event_date, user_id, is_deleted, entry_date) values (@Code, @LoanId, @EventDate, @UserId, 0, getdate()) select cast(scope_identity() as int) "; closeEvent.Id = tx.Connection.Query<int>(query, closeEvent, tx).First(); return closeEvent; }
private static CloseEvent GetCloseEvent(Loan loan) { var closeEvent = new CloseEvent(); closeEvent.Code = "LOCE"; closeEvent.LoanId = loan.Id; closeEvent.UserId = User.CurrentUser.Id; closeEvent.EventDate = TimeProvider.Now; return closeEvent; }