Ejemplo n.º 1
0
        public static bool UpdateConfigurationFromCollection(this DynamicTypeBase dynamicTypeBase, FormCollection formCollection,
                                                             ControllerContext controllerContext)
        {
            var bindModel = formCollection.Parse(controllerContext, dynamicTypeBase.Configuration.Type,
                                                 dynamicTypeBase.Type.Name);

            return(dynamicTypeBase.Configuration.SetConfiguration(bindModel));
        }
Ejemplo n.º 2
0
        public ActionResult ProviderConfigure(int id, FormCollection model)
        {
            var dnsProviderType = DynamicTypeBase.GetCurrent <DnsProviderType>();
            var bindModel       = model.Parse(ControllerContext, dnsProviderType.Configuration.Type);

            dnsProviderType.Configuration.SetConfiguration(bindModel);
            return(PartialView($"{dnsProviderType.Configuration.View}", bindModel));
        }
Ejemplo n.º 3
0
        public ActionResult Configure(string configName, FormCollection model)
        {
            var config = ModuleConfiguration.GetModuleConfiguration(Globals.ModuleId, configName);
            var o      = model.Parse(ControllerContext, config.Type);

            config.SetConfiguration(o);
            return(PartialView(config.View, o));
        }
Ejemplo n.º 4
0
        public ActionResult Configure(int id, FormCollection formCollection)
        {
            TCAdmin.SDK.Cache.ClearCache("__SECURITY");
            var game = TCAdmin.GameHosting.SDK.Objects.Game.GetSelectedGame();
            var customModProvider = DynamicTypeBase.GetCurrent <CustomModBase>("providerId");
            var bindModel         = formCollection.Parse(ControllerContext, customModProvider.Configuration.Type,
                                                         customModProvider.Type.Name);

            return(customModProvider.SetConfigurationForGame(game, bindModel)
                ? this.SendSuccess("Successfully saved the mod settings")
                : this.SendError("Unable to save custom mod settings!"));
        }
Ejemplo n.º 5
0
        public ActionResult ConfigureCron([DynamicTypeBaseBinder] CronJob cronJob, FormCollection model)
        {
            cronJob.ExecuteEverySeconds = int.Parse(Request[$"{cronJob.Configuration.Type.Name}.repeatEvery"]);
            cronJob.Save();
            TempData["repeatEvery"] = cronJob.ExecuteEverySeconds;
            var bindModel = model.Parse(ControllerContext, cronJob.Configuration.Type);

            cronJob.Configuration.SetConfiguration(bindModel);
            return(Json(new
            {
                Message = $"Successfully updated <strong>{cronJob.Type.Name}</strong>"
            }));
        }