Beispiel #1
0
        public async Task <int> RegisterForNotification(string deviceUri, string deviceType, string channelName)
        {
            var item = new SurveyNotificationChannel
            {
                UrlNotification       = deviceUri,
                ChannelName           = channelName,
                ChannelExpirationDate = DateTime.Now.AddDays(30),
                ClientType            = deviceType
            };
            var table    = AzureClient.GetTable <SurveyNotificationChannel>();
            var existing = await table.Where(x => x.UrlNotification == deviceUri).ToListAsync();

            if (existing.Any())
            {
                item = existing.First();
                await table.DeleteAsync(item);
            }
            await table.InsertAsync(item);

            return(item.Id);
        }
Beispiel #2
0
 public async Task<int> RegisterForNotification(string deviceUri, string deviceType, string channelName)
 {
     var item = new SurveyNotificationChannel
     {
         UrlNotification = deviceUri,
         ChannelName = channelName,
         ChannelExpirationDate = DateTime.Now.AddDays(30),
         ClientType = deviceType
     };
     var table = AzureClient.GetTable<SurveyNotificationChannel>();
     var existing = await table.Where(x => x.UrlNotification == deviceUri).ToListAsync();
     if (existing.Any())
     {
         item = existing.First();
         await table.DeleteAsync(item);
     }
     await table.InsertAsync(item);
     return item.Id;
 }