예제 #1
0
        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);
        }
예제 #2
0
 public CustomersController(EventsPlusContext context)
 {
     _context = context;
 }
예제 #3
0
 public BookingsController(EventsPlusContext context)
 {
     _context = context;
 }
예제 #4
0
 public RoleController(EventsPlusContext context)
 {
     _Context = context;
 }
예제 #5
0
 public EventsController(EventsPlusContext context)
 {
     _context = context;
 }
예제 #6
0
 public ManagersController(EventsPlusContext context)
 {
     _context = context;
 }
 public OrganisersController(EventsPlusContext context)
 {
     _context = context;
 }
예제 #8
0
 public AttendeesController(EventsPlusContext context)
 {
     _context = context;
 }