Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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;
 }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
0
 public AppSettings Map(AppSettingsDTO dto)
 {
     if (dto == null) return null;
     var appSettings = Mapper.Map<AppSettingsDTO, AppSettings>(dto);
     return appSettings;
 }
Ejemplo n.º 7
0
 public AIController(IOptions <AppSettingsDTO> appSettings)
 {
     _appSettings = appSettings.Value;
 }
Ejemplo n.º 8
0
 public AuthService(rapidesqlContext context, IOptions <AppSettingsDTO> appSettings)
 {
     _context     = context;
     _appSettings = appSettings.Value;
 }