public IActionResult getAppSettings() { AppSetting title = appSettingsService.getTitle(); if (title == null) { return(BadRequest(new { message = "Nie odnaleziono tytułu w bazie!" })); } TitleSetting t = JsonConvert.DeserializeObject <TitleSetting>(title.SettingValue); AppSetting appState = appSettingsService.getAppState(); if (appState == null) { return(BadRequest(new { message = "Nie odnaleziono stanu aplikacji w bazie! Ustaw stan w ustawieniach!" })); } AppStateSetting a = JsonConvert.DeserializeObject <AppStateSetting>(appState.SettingValue); AppSettingsDTO response = new AppSettingsDTO { title = t.title, appState = a.appState }; if (response == null) { return(BadRequest(new { message = "Błąd pobrania danych ustawień!" })); } return(Ok(response)); }
public ActionResult ConfigureIntervals(int pull, int push) { var model = new AppSettingsDTO() { PullInterval = pull, PushInterval = push }; appSettingsManager.Update(model); return(Json(new object(), JsonRequestBehavior.AllowGet)); }
public UserManagementService(SignInManager <IdentityUser> signInManager, UserManager <IdentityUser> userManager, IOptions <AppSettingsDTO> appSettings, RoleManager <IdentityRole> roleManager, IdentityContext identityContext) { _signInManager = signInManager; _userManager = userManager; _appSettings = appSettings.Value; _roleManager = roleManager; _identityContext = identityContext; }
public void Insert(AppSettingsDTO model) { if (model.PullInterval == 0) { model.PullInterval = 1; } if (model.PushInterval == 0) { model.PushInterval = 10; } uOW.AppSettingRepo.Insert(Mapper.Map <AppSetting>(model)); uOW.Save(); }
public void Update(AppSettingsDTO model) { AppSetting appSetting = uOW.AppSettingRepo.Get().FirstOrDefault(); if (appSetting == null) { this.Insert(model); } else { appSetting.PullInterval = model.PullInterval; appSetting.PushInterval = model.PushInterval; uOW.Save(); } }
public AppSettings Map(AppSettingsDTO dto) { if (dto == null) return null; var appSettings = Mapper.Map<AppSettingsDTO, AppSettings>(dto); return appSettings; }
public AIController(IOptions <AppSettingsDTO> appSettings) { _appSettings = appSettings.Value; }
public AuthService(rapidesqlContext context, IOptions <AppSettingsDTO> appSettings) { _context = context; _appSettings = appSettings.Value; }