Beispiel #1
0
        public async Task <IActionResult> AssetConfiguration()
        {
            var boxConfig = await assetConfigRepo.GetAll();

            var Volats = gameManager.GetVolatilities();


            var viewModel = new AssetConfigurationViewModel
            {
                SaveInformation  = "Saving ths form will update Asset Configuration and recalculate game parameters.",
                BoxConfiguration = boxConfig.Select(i =>
                                                    new BoxSizeModel
                {
                    AssetPair      = i.AssetPair,
                    BoxesPerRow    = i.BoxesPerRow,
                    BoxHeight      = i.BoxHeight,
                    BoxWidth       = i.BoxWidth,
                    GameAllowed    = i.GameAllowed,
                    SaveHistory    = i.SaveHistory,
                    TimeToFirstBox = i.TimeToFirstBox,
                    ScaleK         = i.ScaleK,
                    Volatility     = Volats.ContainsKey(i.AssetPair) ? Volats[i.AssetPair] : 0
                }).ToList()
            };

            return(View(viewModel));
        }
Beispiel #2
0
        public async Task <ActionResult> AssetConfiguration([Bind("BoxConfiguration")] AssetConfigurationViewModel config)
        {
            if (ModelState.IsValid)
            {
                await assetConfigRepo.InsertManyAsync(config.BoxConfiguration);

                config.SaveInformation = "Asset Configuration Saved Successfully";
                await gameManager.ReloadGameAssets();

                bool asOk = await assetQuoteSubscriber.ReloadAssetConfiguration();

                await log?.WriteInfoAsync("BoxOptions.Public.GameController", "AssetConfiguration", null, "Asset configuration changed");
            }

            return(View(config));
        }