Пример #1
0
        public IHttpActionResult Unregister(string installationToken)
        {
            var device = UserDevice.FindByInstallationToken(installationToken);

            if (device != null)
            {
                Database.Update(device, d => d.PushNotificationToken = null);
            }

            return(Ok());
        }
Пример #2
0
        public IHttpActionResult Register(RegisterPushNotificationArgs args)
        {
            var device = UserDevice.FindByInstallationToken(args.InstallationToken)?.Clone() ?? new UserDevice();

            device.UserId                = args.UserId;
            device.InstallationToken     = args.InstallationToken;
            device.PushNotificationToken = args.PushNotificationToken;
            device.DeviceType            = args.DeviceType;
            device.InstallationTime      = LocalTime.Now;
            Database.Save(device);

            return(Ok(device.PushNotificationToken));
        }