public async Task <int> GetLastInsertedUserId() { await base._dBContext.OpenDBConnectionAsync(); using (base._dBContext.DbConnection) { return(await base._dBContext.DbConnection.ExecuteScalarAsync <int>(DapperHelperQueries.SelectSessionLastInsertedUserId())); } }
public async Task CreateAsync(AppUser user) { await base._dBContext.ExecuteTransactionAsync(new Dictionary <string, object>() { { @"INSERT INTO AppUser (UserName, Email, Password) VALUES (@UserName, @Email, @Password); ", new { UserName = user.UserName, Email = user.Email, Password = user.Password } }, { $@"INSERT INTO AppUserProfile (UserId) VALUES ( ( { DapperHelperQueries.SelectSessionLastInsertedUserId() } ) ); ", null }, { DapperHelperQueries.CreateNewLog($"( {DapperHelperQueries.SelectSessionLastInsertedUserId()} )", EventTypeId.Register), new { IPv4 = user.Ipv4 } } }, false); }