public ActionResult premium() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value }); } var data = JsonConvert.DeserializeObject<Premium>(json); _premium_options.Update(opt => { opt.enable_payment = data.enable_payment; opt.premium_option = data.premium_option; opt.premium_redirect_option = data.premium_redirect_option; opt.enable_paypal = data.enable_paypal; opt.paypal_receiver_email = data.paypal_receiver_email; opt.sandbox_mode = data.sandbox_mode; }); //ApplicationLifetime.StopApplication(); return Ok(new { status = 200 }); }
public ActionResult contact() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Contact>(json); _contact_options.Update(opt => { opt.address = data.address; opt.tel1 = data.tel1; opt.tel2 = data.tel2; opt.fax = data.fax; opt.email = data.email; opt.detail_info = data.detail_info; opt.enable_contact_form = data.enable_contact_form; }); // ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult smtp() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Smtp>(json); _smtp_options.Update(opt => { opt.enable_email = data.enable_email; opt.enable_mandril = data.enable_mandril; opt.mandril_key = data.mandril_key; opt.enable_SES = data.enable_SES; opt.ses_host = data.ses_host; opt.ses_username = data.ses_username; opt.ses_password = data.ses_password; opt.Server = data.Server; opt.Port = data.Port; opt.FromAddress = data.FromAddress; }); // ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public async Task <IActionResult> Index([Required] MobilPayConfigurationViewModel model) { if (!ModelState.IsValid) { return(View(model)); } if (!model.PrivateCertificate.FileName.Contains(model.Signature)) { ModelState.AddModelError(string.Empty, "Invalid private key"); return(View(model)); } if (!model.PublicCertificate.FileName.Contains(model.Signature)) { ModelState.AddModelError(string.Empty, "Invalid private key"); return(View(model)); } var rootPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); var privateKeyPath = Path.Combine(rootPath, model.PrivateCertificate.FileName); if (!_writableOptions.Value.PathToPrivateKey.IsNullOrEmpty()) { if (System.IO.File.Exists(privateKeyPath)) { System.IO.File.Delete(privateKeyPath); } } using (var stream = System.IO.File.Create(privateKeyPath)) { await model.PrivateCertificate.CopyToAsync(stream); } var publicKeyPath = Path.Combine(rootPath, model.PublicCertificate.FileName); if (!_writableOptions.Value.PathToCertificate.IsNullOrEmpty()) { if (System.IO.File.Exists(publicKeyPath)) { System.IO.File.Delete(publicKeyPath); } } using (var stream = System.IO.File.Create(publicKeyPath)) { await model.PublicCertificate.CopyToAsync(stream); } _writableOptions.Update(options => { options.Signature = model.Signature; options.IsSandbox = model.IsSandbox; options.PathToCertificate = model.PublicCertificate.FileName; options.PathToPrivateKey = model.PrivateCertificate.FileName; }); ViewData["isSuccess"] = true; return(View(model)); }
public async Task <IActionResult> ArticleRightSideBarWidgetSettings(ArticleRightSideBarWidgetOptionsViewModel articleRightSideBarWidgetOptionsViewModel) { var categoriesResult = await _categoryService.GetAllByNonDeletedAndActiveAsync(); articleRightSideBarWidgetOptionsViewModel.Categories = categoriesResult.Data.Categories; if (ModelState.IsValid) { _articleRightSideBarWidgetOptionsWriter.Update(x => { x.Header = articleRightSideBarWidgetOptionsViewModel.Header; x.TakeSize = articleRightSideBarWidgetOptionsViewModel.TakeSize; x.CategoryId = articleRightSideBarWidgetOptionsViewModel.CategoryId; x.FilterBy = articleRightSideBarWidgetOptionsViewModel.FilterBy; x.OrderBy = articleRightSideBarWidgetOptionsViewModel.OrderBy; x.IsAscending = articleRightSideBarWidgetOptionsViewModel.IsAscending; x.StartAt = articleRightSideBarWidgetOptionsViewModel.StartAt; x.EndAt = articleRightSideBarWidgetOptionsViewModel.EndAt; x.MaxViewCount = articleRightSideBarWidgetOptionsViewModel.MaxViewCount; x.MinViewCount = articleRightSideBarWidgetOptionsViewModel.MinViewCount; x.MaxCommentCount = articleRightSideBarWidgetOptionsViewModel.MaxCommentCount; x.MinCommentCount = articleRightSideBarWidgetOptionsViewModel.MinCommentCount; }); _toastNotification.AddSuccessToastMessage("Makale sayfalarınızın widget ayarları başarıyla güncellenmiştir.", new ToastrOptions { Title = "Başarılı İşlem!" }); return(View(articleRightSideBarWidgetOptionsViewModel)); } return(View(articleRightSideBarWidgetOptionsViewModel)); }
public async Task <IActionResult> GenerateDefaultCurrency(int id) { if (await _currencyRepository.CountAsync() > 0) { return(BadRequest("you already created currency")); } var currencyModel = _predefinedGuideService.GetCurrecny(id); if (currencyModel == null) { return(NotFound()); } var currency = new Currency(currencyModel.Code, currencyModel.GetName(_language), 1, currencyModel.GetPartName(_language), currencyModel.PartRate, currencyModel.ISOCode); var affectedRows = await _currencyRepository.AddAsync(currency); if (affectedRows > 0) { _defaultKeysOptions.Update(a => a.CurrencyId = currency.Id); return(Ok()); } return(BadRequest()); }
public ActionResult authentication() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Authentication>(json); _authentication_options.Update(opt => { opt.enable_facebook = data.enable_facebook; opt.fb_appId = data.fb_appId; opt.fb_appSecrete = data.fb_appSecrete; opt.enable_twitter = data.enable_twitter; opt.tw_consumer_key = data.tw_consumer_key; opt.tw_consumer_secrete = data.tw_consumer_secrete; opt.enable_google = data.enable_google; opt.google_clientid = data.google_clientid; opt.google_clientsecrete = data.google_clientsecrete; }); // ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult media() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Media>(json); _media_options.Update(opt => { opt.user_thumbnail_width = data.user_thumbnail_width; opt.user_thumbnail_height = data.user_thumbnail_height; opt.category_thumbnail_width = data.category_thumbnail_width; opt.category_thumbnail_height = data.category_thumbnail_height; opt.gamify_badge_height = data.gamify_badge_height; opt.gamify_badge_width = data.gamify_badge_width; opt.photo_extensions = data.photo_extensions; opt.photo_max_size = data.photo_max_size; opt.quality = data.quality; opt.logo_path = data.logo_path; opt.logo_footer_path = data.logo_footer_path; opt.user_default_path = data.user_default_path; opt.category_default_path = data.category_default_path; opt.gamify_default_path = data.gamify_default_path; }); //ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult listings() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Listing>(json); _listings_options.Update(opt => { opt.enable_views = data.enable_views; opt.enable_date = data.enable_date; opt.enable_username = data.enable_username; opt.enable_rating = data.enable_rating; opt.enable_likedislike = data.enable_likedislike; }); //ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult aws() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Aws>(json); _aws_options.Update(opt => { opt.enable = data.enable; opt.accessKey = data.accessKey; opt.secretKey = data.secretKey; opt.region = data.region; opt.bucket = data.bucket; opt.user_photos_directory = data.user_photos_directory; opt.category_photos_directory = data.category_photos_directory; opt.gamify_badges_directory = data.gamify_badges_directory; opt.cdn_URL = data.cdn_URL; }); // ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult features() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Features>(json); _features_options.Update(opt => { opt.enable_blogs = data.enable_blogs; opt.enable_forums = data.enable_forums; opt.enable_categories = data.enable_categories; opt.enable_tags = data.enable_tags; opt.showLabelCounter = data.showLabelCounter; opt.enable_archives = data.enable_archives; opt.enable_date_filter = data.enable_date_filter; opt.enable_advertisement = data.enable_advertisement; opt.enable_adult_veritifcation = data.enable_adult_veritifcation; opt.enable_languages = data.enable_languages; }); //ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult elasticsearch() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <ElasticSearch>(json); _elasticsearch_options.Update(opt => { opt.enable = data.enable; opt.index = data.index; opt.adlisting_index = data.adlisting_index; opt.agency_index = data.agency_index; opt.blogs_index = data.blogs_index; opt.url = data.url; opt.username = data.username; opt.password = data.password; }); //ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult zendesk() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Zendesk>(json); _zendesk_options.Update(opt => { opt.enable = data.enable; opt.url = data.url; opt.user = data.user; opt.token = data.token; opt.locale = data.locale; }); //ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult social() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Social>(json); _social_options.Update(opt => { opt.facebook_url = data.facebook_url; opt.twitter_url = data.twitter_url; opt.flickr_url = data.flickr_url; opt.linkedin_url = data.linkedin_url; opt.thumblr_url = data.thumblr_url; opt.google_url = data.google_url; opt.youtube_url = data.youtube_url; opt.vimeo_url = data.vimeo_url; opt.pinterest_url = data.pinterest_url; opt.instagram_url = data.instagram_url; opt.github_url = data.github_url; opt.rss_url = data.rss_url; opt.fb_appId = data.fb_appId; }); // ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public ActionResult registration() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <Registration>(json); _registration_options.Update(opt => { opt.enable = data.enable; opt.enableChapcha = data.enableChapcha; opt.uniqueFieldOption = data.uniqueFieldOption; opt.enableNameField = data.enableNameField; opt.enablePrivacyCheck = data.enablePrivacyCheck; }); // ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public IActionResult Change(string value) { //_locationsMonitor.CurrentValue.Name = value; //_configuration["Greeting"] = value; _writableLocations.Update(opt => { opt.Name = value; }); return(Ok(_locationsMonitor.CurrentValue.Name)); }
public async Task Configure(DbConfig dbConfig) { options.Update(opt => { opt.LeagueManager = $"Server={dbConfig.DatabaseServer};Database={dbConfig.DatabaseName};Trusted_Connection=True;Application Name=LeagueManager"; }); await InitializeDb(); }
public IActionResult Settings(RedisConnectionConfig model) { _writableOptions.Update(opt => { opt.Host = model.Host; opt.Port = model.Port; }); return(View()); }
public async Task <IActionResult> OnPostAsync() { // Check basic validation first and bail out early before anything gets updated. if (!ModelState.IsValid) { return(Page()); } if (Uri.CheckHostName(Setup.SiteHostname) != UriHostNameType.Dns) { ModelState.AddModelError("Setup.Domain", "Invalid domain name"); } if (!ModelState.IsValid) { return(Page()); } _httpServerOptions.Update(x => { x.SiteHostname = Setup.SiteHostname; x.HttpsPort = Setup.HttpsPort; }); var acmeAccount = await _dataContext.AcmeAccounts.FirstAsync(x => x.IsAcmeStaging == Setup.UseAcmeStaging); var acmeCert = await _dataContext.AcmeCertificates .Include(x => x.AcmeAccount) .ThenInclude(x => x.Key) .FirstOrDefaultAsync(x => x.Subject == Setup.SiteHostname && x.AcmeAccountId == acmeAccount.AcmeAccountId); if (acmeCert == null) { var certKey = await _dataContext.Keys.FirstOrDefaultAsync(x => x.Name == Setup.SiteHostname); if (certKey == null) { certKey = _keyGenerator.Generate(Setup.SiteHostname, Certes.KeyAlgorithm.RS256, "certera certificate (this site)"); } acmeCert = new Data.Models.AcmeCertificate { ChallengeType = "http-01", DateCreated = DateTime.UtcNow, Name = Setup.SiteHostname, Subject = Setup.SiteHostname, AcmeAccountId = acmeAccount.AcmeAccountId, KeyId = certKey.KeyId }; _dataContext.AcmeCertificates.Add(acmeCert); await _dataContext.SaveChangesAsync(); } return(RedirectToPage("./Certificate")); }
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { base.OnRenderSizeChanged(sizeInfo); if (WindowState == WindowState.Maximized) { _settings.Update(settings => settings.IsMaximized = true); } else if (WindowState == WindowState.Normal) { _settings.Update(settings => { settings.IsMaximized = false; settings.Width = sizeInfo.NewSize.Width; settings.Height = sizeInfo.NewSize.Height; }); } }
protected override void WriteOptions() { writableConfigOptions.Update(updatedConfigOptions => { updatedConfigOptions.AutoDetect = configOptions.AutoDetect; updatedConfigOptions.ServerId = configOptions.ServerId; updatedConfigOptions.Printers = configOptions.Printers ?? new Dictionary <string, PrinterConfig>(); }); }
public IActionResult Settings(CacheConfiguration model) { _writableOptions.Update(opt => { opt.Host = model.Host; opt.Port = model.Port; }); return(View()); }
private async Task ProcessConfigRequest(HttpContext context) { var setupSettings = context.ReadContentAsAsync <SetUpDTO>().Result; switch (setupSettings.ServerMode) { case SetUpDTO.ServerModeEnum.Cloud: #region Paramétrage de la base de données en mode cloud throw new NotImplementedException("Not implemented yet"); #endregion //break; case SetUpDTO.ServerModeEnum.Server: #region Paramétrage de la base de données en mode serveur if (setupSettings.DatabaseSettings == null) { throw new ArgumentException($"L'objet de type {nameof(DatabaseSettingsDTO)} vaut null."); } // Mise à jour des paramètres dans le fichier de configuration string connectionString = setupSettings.DatabaseSettings.ToConnectionString(); appSettings.Update(settings => { string defaultConnectionStringName = "Default"; if (settings.ConnectionStrings.Any(connection => connection.Name == defaultConnectionStringName)) { settings.ConnectionStrings.FirstOrDefault(connection => connection.Name == defaultConnectionStringName).ConnectionString = setupSettings.DatabaseSettings.ToConnectionString(); } else { settings.ConnectionStrings.Add(new ConnectionStringSettings { Name = defaultConnectionStringName, ConnectionString = connectionString }); } settings.UsedConnectionString = defaultConnectionStringName; }); // Application des migrations var dbContextFactoryType = Assembly.GetEntryAssembly().GetTypes().FirstOrDefault(t => typeof(IDesignTimeDbContextFactory <DbContext>).IsAssignableFrom(t)); if (dbContextFactoryType != null) { var dbContextFactory = Activator.CreateInstance(dbContextFactoryType) as IDesignTimeDbContextFactory <DbContext>; dbContextFactory.CreateDbContext(new string[] { }); } #endregion break; } // If reach here, that means that no valid parameter has been passed. Just output status await SendOkResponse(context, string.Format("La chaine de connexion a été affectée")); return; }
/// <summary> /// Creates the reusable web driver. /// </summary> /// <param name="options">The options.</param> /// <returns>The webdriver.</returns> public static IWebDriver CreateReusableWebDriver(IWritableOptions <ConfigurationParameters> options) { var sessionId = options?.Value.BrowsersConfiguration.SessionId; var url = options.Value.BrowsersConfiguration.WebDriverUrl; if (sessionId != null && url != null) { return(new ReuseRemoteWebDriver( url, sessionId, CreateChromeOptions())); } var driver = CreateWebDriver(options); options.Update(opt => opt.BrowsersConfiguration.SessionId = driver.SessionId.ToString()); options.Update(opt => opt.BrowsersConfiguration.WebDriverUrl = ReuseRemoteWebDriver.GetExecutorURLFromDriver(driver)); return(driver); }
public async Task <Guid?> UpdateHeader(IFormFile image, CancellationToken cancellationtoken = default(CancellationToken)) { Guid?imageId = await ImageHandler.SaveImageToFile(image, cancellationtoken); writableHeader.Update(opt => { opt.ImageId = imageId; }); return(imageId); }
public ActionResult general() { var json = new StreamReader(Request.Body).ReadToEnd(); if (json == "") { return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value })); } var data = JsonConvert.DeserializeObject <General>(json); _general_options.Update(opt => { opt.site_theme = data.site_theme; opt.website_title = data.website_title; opt.website_description = UtilityBLL.processNull(data.website_description, 0); opt.page_caption = UtilityBLL.processNull(data.page_caption, 0); opt.website_phone = UtilityBLL.processNull(data.website_phone, 0); opt.admin_mail = UtilityBLL.processNull(data.admin_mail, 0); opt.admin_mail_name = UtilityBLL.processNull(data.admin_mail_name, 0); opt.pagination_links = data.pagination_links; opt.pagination_type = data.pagination_type; opt.screen_content = data.screen_content; opt.content_approval = data.content_approval; if (data.spam_count > 0) { opt.spam_count = data.spam_count; } opt.cache_duration = data.cache_duration; if (data.max_cache_pages > 0) { opt.max_cache_pages = data.max_cache_pages; } opt.store_searches = data.store_searches; opt.store_ipaddress = data.store_ipaddress; opt.maximum_dynamic_link_length = data.maximum_dynamic_link_length; opt.default_culture = UtilityBLL.processNull(data.default_culture, 0); if (opt.pagesize > 0) { opt.pagesize = data.pagesize; } opt.rating_option = data.rating_option; opt.jwt_private_key = data.jwt_private_key; opt.init_wiz = true; // used to stop installation process after application deployment, don't remove it }); //ApplicationLifetime.StopApplication(); return(Ok(new { status = 200 })); }
public void UpdateAppConfig() { var newValueSymbols = Symbols.Select(s => new ValueSymbol() { InstancePath = s.InstancePath, Type = s.Type, CycleTime = 500, MaxDelay = 5000 }).ToList(); _appOptions.Update(opt => opt.ValueSymbols = newValueSymbols); newValueSymbols.Clear(); }
private void BtnOK_Click(object sender, RoutedEventArgs e) { _appSettingsOpt.Update(o => { o.RootDirectory = _vm.RootDirectory; o.DefaultLanguage = _vm.SelectedLanguage.DisplayName; }); DialogResult = true; Close(); }
public IActionResult OnPostAppSettings(AppSettingsInputModel appSettingsInput) { if (ModelState.IsValid) { _appSettings.Update(opt => { opt.PortfolioTitle = appSettingsInput.AppTitle; }); } GetInputData(); return(Page()); }
public IActionResult UpdateDialogFlow([FromBody] DialogFlow dialogFlow) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _dialogFlowWriteOptions.Update(opt => { opt.NextResponse = dialogFlow.NextResponse; opt.Answer = dialogFlow.Answer; opt.Branches = dialogFlow.Branches; }); return(NoContent()); }