public static WaitingRoomViewModel Create(BingoContext db)
        {
            var calls = (from call in db.BingoCalls
                         where db.BingoCalls.Where(x => x.ValidBoard).Select(x => x.Game.Id).Contains(call.Game.Id)
                         group call by call.Game.Id
                             into game
                             select
                                 db.BingoCalls.Where(x => x.Game.Id == game.Key && x.ValidBoard && x.CalledAt == game.Where(y => y.ValidBoard).Min(y => y.CalledAt)).FirstOrDefault()
                        ).Select(x=>x.Id).ToList();

            var viewModel = new WaitingRoomViewModel()
                                {
                                    Game = db.Games.Where(a => a.InProgress).SingleOrDefault(),
                                    BingoCalls = db.BingoCalls.Include("Game").Include("Callee").Where(a=> calls.Contains(a.Id)).ToList()
                                };

            return viewModel;
        }
        public static WaitingRoomViewModel Create(BingoContext db)
        {
            var calls = (from call in db.BingoCalls
                         where db.BingoCalls.Where(x => x.ValidBoard).Select(x => x.Game.Id).Contains(call.Game.Id)
                         group call by call.Game.Id
                         into game
                         select
                         db.BingoCalls.Where(x => x.Game.Id == game.Key && x.ValidBoard && x.CalledAt == game.Where(y => y.ValidBoard).Min(y => y.CalledAt)).FirstOrDefault()
                         ).Select(x => x.Id).ToList();

            var viewModel = new WaitingRoomViewModel()
            {
                Game       = db.Games.Where(a => a.InProgress).SingleOrDefault(),
                BingoCalls = db.BingoCalls.Include("Game").Include("Callee").Where(a => calls.Contains(a.Id)).ToList()
            };

            return(viewModel);
        }
 public BracketsController(BingoContext context)
 {
     _context = context;
 }
 public ContendersController(BingoContext context)
 {
     _context = context;
 }
Example #5
0
 public HomeController(BingoContext context)
 {
     _context = context;
 }
 public BingoBoardsController(BingoContext context)
 {
     _context = context;
 }
Example #7
0
 public EntrantsController(BingoContext context, IHostingEnvironment hostingEnvironment)
 {
     _context            = context;
     _hostingEnvironment = hostingEnvironment;
 }
Example #8
0
 public GamesController(ILogger <HomeController> logger, BingoContext context)
 {
     _logger  = logger;
     _context = context;
 }
Example #9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, BingoContext context)
        {
            //loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            //loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            DbInitializer.Initialize(context);
        }