public IActionResult Create(int project) { AntigateConfig config = new AntigateConfig() { ProjectModule = new ProjectModule() { ProjectId = project } }; try { var targetProject = _reposiotry.GetProject(project); if (targetProject == null) { throw new UserException($"Project {project} isn't find"); } config.ProjectModule.Project = targetProject; } catch (UserException exc) { _logger.LogError(exc.Message); TempData["message"] = exc.Message; } return(View(new AntigateModulViewModel(config) { HttpModules = ProjectModuleRegistry.GetModules <HttpProviderRuntimeConfig, HttpProviderData>(_context, _moduleRegistry, project) })); }
public bool CreateAndSave(AntigateConfig config) { config.ProjectModule.Code = ModuleCode; config.ProjectModule.CreatedTime = DateTime.Now; config.ProjectModule.ProjectId = config.ProjectModule.ProjectId; return(Context.Repository.AddModule(config.ProjectModule) & Context.Repository.AddAntigateConfig(config)); }
public bool SaveConfig(AntigateConfig config) { var projectModule = Context.Repository.GetModule(Id); projectModule.Name = config.ProjectModule.Name; projectModule.Description = config.ProjectModule.Description; Configuration.ClientKey = config.ClientKey; Configuration.CallbackUrl = config.CallbackUrl; Configuration.LanguagePool = config.LanguagePool; Configuration.SoftId = config.SoftId; Configuration.HttpModuleId = config.HttpModuleId; return(Context.Repository.UpdateModule(projectModule) & Context.Repository.UpdateAntigateConfig(Configuration)); }
public bool UpdateAntigateConfig(AntigateConfig config) { var target = GetAntigateConfig(config.ProjectModuleId); if (target != null) { target.Id = config.Id; target.LanguagePool = config.LanguagePool; target.SoftId = config.SoftId; target.CallbackUrl = config.CallbackUrl; target.HttpModuleId = config.HttpModuleId; return(_context.SaveChanges() == 0); } return(_context.SaveChanges() == 0); }
public bool LoadConfig() { Configuration = Context.Repository.GetAntigateConfig(Id) ?? new AntigateConfig(); return(true); }
public bool AddAntigateConfig(AntigateConfig config) { _context.AntigateConfigs.Add(config); return(_context.SaveChanges() == 0); }