@@ -37,7 +37,6 @@ import androidx.compose.ui.unit.dp
37
37
import androidx.compose.ui.unit.sp
38
38
import com.example.ticketapp.components.HeaderComponent
39
39
import com.example.ticketapp.components.SearchBarSection
40
- import com.example.ticketapp.models.ConcertsSectionData
41
40
import com.example.ticketapp.ui.theme.TicketAppTheme
42
41
43
42
import android.app.PendingIntent
@@ -58,6 +57,11 @@ import androidx.navigation.compose.rememberNavController
58
57
import com.example.ticketapp.components.EventDetails
59
58
import com.example.ticketapp.components.TicketBookingScreen
60
59
import com.example.ticketapp.components.TicketComponent
60
+ import com.example.ticketapp.data.ConcertSection
61
+ import com.example.ticketapp.database.AppDatabase
62
+ import com.example.ticketapp.models.Event
63
+ import kotlinx.coroutines.GlobalScope
64
+ import kotlinx.coroutines.launch
61
65
62
66
class MainActivity : ComponentActivity () {
63
67
@@ -159,6 +163,19 @@ class MainActivity : ComponentActivity() {
159
163
}
160
164
}
161
165
166
+ fun populateDatabase () {
167
+ val eventDao = AppDatabase .getDatabase(this ).eventDao()
168
+
169
+ // Créez des instances de Event
170
+ val event1 = Event (eventId = 1 , name = " Nom de l'événement" , description = " Loremdjdeere" , dateTime = " eee" , location = " Terre" )
171
+ val event2 = Event (eventId = 2 , name = " Nom de l'événement" , description = " Loremdjdeere" , dateTime = " eee" , location = " Location 2" )
172
+ GlobalScope .launch {
173
+ // Insérez les événements dans la base de données
174
+ eventDao.insertEvent(event1)
175
+ eventDao.insertEvent(event2)
176
+ // Insérez autant d'événements que vous le souhaitez
177
+ }
178
+ }
162
179
@Preview(showSystemUi = true )
163
180
@Composable
164
181
fun HomeScreen () {
@@ -181,7 +198,7 @@ class MainActivity : ComponentActivity() {
181
198
fontSize = 20 .sp
182
199
)
183
200
184
- ConcertsSectionData ()
201
+ ConcertSection ()
185
202
186
203
Row (
187
204
modifier = Modifier
0 commit comments