Exemplo n.º 1
0
        public async Task <HttpResponseMessage> CreatePushNotificationAlert(int userId)
        {
            var userrepo = new UserRepository();
            var user     = userrepo.Get(userId);

            var settingsrepo            = new SettingsRepository();
            var notificationTitle       = settingsrepo.GetByKey("NOTIFICATION_PUSH_TITLE");
            var notificationDescription = settingsrepo.GetByKey("NOTIFICATION_PUSH_DESCRIPTION");

            NotificationHubClient hub = NotificationHubClient
                                        .CreateClientFromConnectionString("<connection string with full access>", "<hub name>");
            string toast = @"<toast><visual><binding template=""ToastText01""><text id=""1"">Hello from a .NET App!</text></binding></visual></toast>";
            await hub.SendWindowsNativeNotificationAsync(toast);

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetByKey(string key)
        {
            var repo   = new SettingsRepository();
            var entity = repo.GetByKey(key);

            var json = JsonConvert.SerializeObject(entity);

            return(new HttpResponseMessage {
                Content = new StringContent(json, Encoding.UTF8, "application/json")
            });
        }
Exemplo n.º 3
0
        static void QuerySettings()
        {
            SettingsRepository settingsRepository = new SettingsRepository(connectionString, "settings");

            var s = settingsRepository.Get(1);

            if (s == null)
            {
                settingsRepository.Create(new Setting()
                {
                    SettingKey = "AesIV", SettingValue = "::\"bla'+"
                });
            }

            s = settingsRepository.GetByKey("AesIV");
            s.SettingValue += "upd.";
            settingsRepository.Update(s);
        }