Esempio n. 1
0
        public async Task UpdateOptionsAsync(string userId, string configurationId, PushChannelOptions options)
        {
            var channel = configurationContext.PushChannelConfigurations.Include(v => v.Options).Where(v => v.UserId == userId && v.Id == configurationId).Single();

            foreach (var opt in channel.Options)
            {
                configurationContext.PushChannelOptions.Remove(opt);
            }
            await CreateOptionsAsync(options, channel.Id, false);

            await configurationContext.SaveChangesAsync();
        }
Esempio n. 2
0
            public async Task PutAsync(PushChannelOptions options)
            {
                var client = await clientFactory();

                var json = JsonConvert.SerializeObject(options);
                var res  = await client.PutAsync($"api/{userId}/pushchannels/{channelId}/options",
                                                 new StringContent(json, Encoding.UTF8, "application/json"));

                if (!res.IsSuccessStatusCode)
                {
                    throw new DigitPushServiceException($"Update channel options resulted in {res.StatusCode}.");
                }
            }
 public Task UpdateOptionsAsync(string userId, string configurationId, PushChannelOptions options)
 {
     return(pushConfigurationStore.UpdateOptionsAsync(userId, configurationId, options));
 }
Esempio n. 4
0
        public async Task <IActionResult> Update(string userId, string configurationid, [FromBody] PushChannelOptions options)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            if (!(await pushConfigurationManager.GetAllAsync(userId)).Any(v => v.Id == configurationid))
            {
                return(NotFound());
            }
            await pushConfigurationManager.UpdateOptionsAsync(userId, configurationid, options);

            return(Ok());
        }