public ActionResult Index(GlobalSettingModel model) { if (CurrentUser.UserRole == Enums.UserRole.Viewer || CurrentUser.UserRole == Enums.UserRole.Controller) { return(RedirectToAction("Index")); } Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); config.AppSettings.Settings["UseBackdate"].Value = model.UseBackDate.ToString(); config.AppSettings.Settings["SendXmlMasterData"].Value = model.IsSendXmlMasterData.ToString(); //model.UseBackDate = (bool.TrueString.ToLower() == config.AppSettings.Settings["UseBackdate"].Value.ToLower()); HttpRuntimeSection section = (HttpRuntimeSection)config.GetSection("system.web/httpRuntime"); if (model.FileSizeType == FileSizeType.MB) { section.MaxRequestLength = (int)(model.UploadFileSize * 1024f); } else { section.MaxRequestLength = model.UploadFileSize; } config.Save(ConfigurationSaveMode.Modified); //model.SizeType = fillSizeType(); //model.UploadFileSize = section.MaxRequestLength; return(RedirectToAction("Index")); }
public async Task SaveHasSeenCartTooltipForTranscriptsInSearchModeByPortfolioIdAsync_should_return_correct_result() { // Arrange: var sut = CreateService(); var mockGlobalSettings = new GlobalSettingModel { HasSeenCartTooltipForTranscriptsInSavedSchoolsMode = true, HasSeenCartTooltipForTranscriptsInSearchMode = true }; _mockOnboardingFlagsRepo.Setup(x => x.SaveHasSeenCartTooltipForTranscriptsInSearchModeByPortfolioIdAsync(It.IsAny <int>())).ReturnsAsync(mockGlobalSettings); _mockOnboardingFlagsRepo.Setup(x => x.GetByPortfolioIdAsync(It.IsAny <int>())).ReturnsAsync(mockGlobalSettings); var expected = new OnboardingFlagsModel( new Dictionary <OnboardingFlagsKeyName, bool>() { { OnboardingFlagsKeyName.HasSeenCartTooltipForTranscriptsInSavedSchoolsMode, true }, { OnboardingFlagsKeyName.HasSeenCartTooltipForTranscriptsInSearchMode, true } } ); // Act: var result = await sut.SaveHasSeenCartTooltipForTranscriptsInSearchModeByPortfolioIdAsync(1); // Assert: Assert.IsNotNull(result); Assert.AreEqual(ToAssertableString(expected), ToAssertableString(result)); }
// // GET: /GlobalSettings/ public ActionResult Index() { var model = new GlobalSettingModel(); model.UseBackDate = (bool.TrueString.ToLower() == ConfigurationManager.AppSettings.Get("UseBackdate").ToLower()); model.IsSendXmlMasterData = (bool.TrueString.ToLower() == ConfigurationManager.AppSettings.Get("SendXmlMasterData").ToLower()); HttpRuntimeSection section = (HttpRuntimeSection)ConfigurationManager.GetSection("system.web/httpRuntime"); model.MainMenu = Enums.MenuList.Settings; model.CurrentMenu = PageInfo; model.FileSizeType = FileSizeType.KB; model.SizeType = fillSizeTypeList(); model.UploadFileSize = section.MaxRequestLength; model.IsNotViewer = CurrentUser.UserRole != Enums.UserRole.Viewer && CurrentUser.UserRole != Enums.UserRole.Controller; //model.SizeType return(View(model)); }