public ScriptExecutionService(
     SqLiteDataContext Context,
     ILogger <ScriptExecutionService> Logger,
     IConfiguration Configuration,
     IScriptService ScriptService)
 {
     _context       = Context;
     _logger        = Logger;
     _configuration = Configuration;
     _scriptService = ScriptService;
 }
Example #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, SqLiteDataContext context)
        {
            context.Database.Migrate();
            app.UseRouting();

            app.UseSerilogRequestLogging();

            // global cors policy
            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints => endpoints.MapControllers());
        }
Example #3
0
        public ActionResult CreateGame(CreateGameModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            using (var db = new SqLiteDataContext())
            {
                Visit v = new Visit()
                {
                    GameName  = model.GameId,
                    IpAddress = GetUser_IP(),
                    Time      = DateTime.Now,
                    Pass      = model.Password,
                    UserName  = model.Player1
                };
                db.Visits.Add(v);
                db.SaveChanges();
            }
            var kernel = new StandardKernel(new CoreModule());
            var game   = kernel.Get <GameBoard>();

            try
            {
                game.DeleteOldGames();
                game.CreateGame(new List <string>()
                {
                    model.Player1
                }, model.GameId, model.Password);
                return(RedirectToAction("ConnectToGame", "angular/app", new { UserName = model.Player1, GameId = model.GameId, GameGuid = game.GetGuid(model.GameId) }));
            }
            catch (Exception)
            {
                ModelState.AddModelError("", "Не удалось создать игру. Возможно имя совпадает с уже существующей игрой");
                return(View(model));
            }
        }
Example #4
0
 public UserService(SqLiteDataContext Context)
 {
     _context = Context;
 }
Example #5
0
 public ScriptService(SqLiteDataContext Context)
 {
     _context = Context;
 }