public async Task SeedDatabaseAsync() { await Delete(); await FluentEntity.InsertInto(Roles).ExecuteAsync(); await FluentEntity.InsertInto(Cities).ExecuteAsync(); await FluentEntity.InsertInto(Addresses).ExecuteAsync(); await FluentEntity.InsertInto(Users).ExecuteAsync(); await FluentEntity.InsertInto(Genres).ExecuteAsync(); await FluentEntity.InsertInto(Movies).ExecuteAsync(); await FluentEntity.InsertInto(Actors).ExecuteAsync(); await FluentEntity.InsertInto(MovieActors).ExecuteAsync(); await FluentEntity.InsertInto(CinemaHalls).ExecuteAsync(); await FluentEntity.InsertInto(RowCategories).ExecuteAsync(); await FluentEntity.InsertInto(Rows).ExecuteAsync(); await FluentEntity.InsertInto(Seats).ExecuteAsync(); await FluentEntity.InsertInto(Schedules).ExecuteAsync(); await FluentEntity.InsertInto(Reservations).ExecuteAsync(); await FluentEntity.InsertInto(SeatReservations).ExecuteAsync(); }
private async Task Delete() { await FluentEntity.Delete <SeatReservation>().ExecuteAsync(); await FluentEntity.Delete <Reservation>().ExecuteAsync(); await FluentEntity.Delete <Ticket>().ExecuteAsync(); await FluentEntity.Delete <Schedule>().ExecuteAsync(); await FluentEntity.Delete <Seat>().ExecuteAsync(); await FluentEntity.Delete <Row>().ExecuteAsync(); await FluentEntity.Delete <RowCategory>().ExecuteAsync(); await FluentEntity.Delete <CinemaHall>().ExecuteAsync(); await FluentEntity.Delete <MovieActor>().ExecuteAsync(); await FluentEntity.Delete <Actor>().ExecuteAsync(); await FluentEntity.Delete <Movie>().ExecuteAsync(); await FluentEntity.Delete <Genre>().ExecuteAsync(); await FluentEntity.Delete <User>().ExecuteAsync(); await FluentEntity.Delete <Address>().ExecuteAsync(); await FluentEntity.Delete <City>().ExecuteAsync(); await FluentEntity.Delete <Role>().ExecuteAsync(); }
public async Task SeedDatabase() { if (EntityDependsOnRole()) { Roles = CreateRoles(); await FluentEntity.InsertInto(Roles).ExecuteAsync(); } if (EntityDependsOnCity()) { Cities = CreateCities(); await FluentEntity.InsertInto(Cities).ExecuteAsync(); } if (EntityDependsOnAddress()) { Addresses = CreateAddresses(); await FluentEntity.InsertInto(Addresses).ExecuteAsync(); } if (EntityDependsOnUser()) { Users = CreateUsers(); await FluentEntity.InsertInto(Users).ExecuteAsync(); } if (EntityDependsOnGenre()) { Genres = CreateGenres(); await FluentEntity.InsertInto(Genres).ExecuteAsync(); } if (EntityDependsOnMovie()) { Movies = CreateMovies(); await FluentEntity.InsertInto(Movies).ExecuteAsync(); } if (EntityDependsOnActor()) { Actors = CreateActors(); await FluentEntity.InsertInto(Actors).ExecuteAsync(); } if (EntityDependsOnMovieActor()) { MovieActors = CreateMovieActors(); await FluentEntity.InsertInto(MovieActors).ExecuteAsync(); } if (EntityDependsOnCinemaHall()) { CinemaHalls = CreateCinemaHalls(); await FluentEntity.InsertInto(CinemaHalls).ExecuteAsync(); } if (EntityDependsOnRowCategory()) { RowCategories = CreateRowCategories(); await FluentEntity.InsertInto(RowCategories).ExecuteAsync(); } if (EntityDependsOnRow()) { Rows = CreateRows(); await FluentEntity.InsertInto(Rows).ExecuteAsync(); } if (EntityDependsOnSeat()) { Seats = CreateSeats(); await FluentEntity.InsertInto(Seats).ExecuteAsync(); } if (EntityDependsOnSchedule()) { Schedules = CreateSchedules(); await FluentEntity.InsertInto(Schedules).ExecuteAsync(); } if (EntityDependsOnReservation()) { Reservations = CreateReservations(); await FluentEntity.InsertInto(Reservations).ExecuteAsync(); } if (EntityDependsOnSeatReservation()) { SeatReservations = CreateSeatReservations(); await FluentEntity.InsertInto(SeatReservations).ExecuteAsync(); } }