public async Task <IActionResult> StoreSubscription([FromBody] WP.PushSubscription subscription)
        {
            var subscriptionId = await _subscriptionStore.StoreSubscriptionAsync(_applicationUser.Id, subscription);

            _logger.LogDebug($"Creating push registration for {_applicationUser.Id} with subscriptionId of {subscriptionId}");
            return(Ok(new {
                uid = subscriptionId,
                status = true
            }));
        }
Example #2
0
        public async Task <IActionResult> StoreSubscription([FromBody] PushSubscription subscription)
        {
            int res = await _subscriptionStore.StoreSubscriptionAsync(subscription);

            if (res > 0)
            {
                return(CreatedAtAction(nameof(StoreSubscription), subscription));
            }

            return(NoContent());
        }
        public async Task <IActionResult> StoreSubscription([FromBody] PushSubscription subscription)
        {
            try
            {
                await _subscriptionStore.StoreSubscriptionAsync(subscription);
            }
            catch (DbUpdateException e)
            {
                // TODO: log exception. Adding existing subscription
            }

            return(NoContent());
        }
        public async Task <IActionResult> StoreSubscription([FromBody] DistrictSubscription subscription)
        {
            try {
#if DEBUG
                subscription.LatestConfirmedCase = 0;
#else
                subscription.LatestConfirmedCase = CovidHelper.Instance.GetLatestCountForDistrict(subscription.District, _miscellenous.DistrictCovidApi);
#endif
                await _subscriptionStore.StoreSubscriptionAsync(subscription);
            }
            catch (Exception exception)
            {
                Console.Write(exception.Message);
            }

            return(NoContent());
        }
Example #5
0
        public async Task <IActionResult> StoreSubscription([FromBody] PushSubscription subscription)
        {
            await _subscriptionStore.StoreSubscriptionAsync(subscription);

            return(NoContent());
        }
Example #6
0
 public async Task <int> StoreSubscriptionAsync([FromBody] PushSubscription subscription)
 {
     return(await _subscriptionStore.StoreSubscriptionAsync(subscription));
 }