private async Task <EventsPlusContext> GetDatabaseContext() { var options = new DbContextOptionsBuilder <EventsPlusContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; var databaseContext = new EventsPlusContext(options); databaseContext.Database.EnsureCreated(); if (await databaseContext.Events.CountAsync() <= 0) { databaseContext.Events.AddRange(Event()); await databaseContext.SaveChangesAsync(); } if (await databaseContext.EventTypes.CountAsync() <= 0) { databaseContext.EventTypes.AddRange(EventType()); await databaseContext.SaveChangesAsync(); } if (await databaseContext.Managers.CountAsync() <= 0) { databaseContext.Managers.AddRange(Manager()); await databaseContext.SaveChangesAsync(); } return(databaseContext); }
public CustomersController(EventsPlusContext context) { _context = context; }
public BookingsController(EventsPlusContext context) { _context = context; }
public RoleController(EventsPlusContext context) { _Context = context; }
public EventsController(EventsPlusContext context) { _context = context; }
public ManagersController(EventsPlusContext context) { _context = context; }
public OrganisersController(EventsPlusContext context) { _context = context; }
public AttendeesController(EventsPlusContext context) { _context = context; }