예제 #1
0
        public IActionResult DeleteUserDevice([FromBody, BindRequired] DeleteDeviceToken body)
        {
            var user = this.DomainUser();

            registry.RemoveToken(
                user.Id,
                DeviceId.From(body.DeviceId)
                );

            return(NoContent());
        }
예제 #2
0
        public IActionResult UpdateUserDevice([FromBody, BindRequired] UpdateDeviceToken body)
        {
            var user = this.DomainUser();

            registry.UpdateToken(
                user.Id,
                DeviceId.From(body.DeviceId),
                DeviceToken.From(body.Token)
                );

            return(NoContent());
        }
예제 #3
0
 // TODO: when we may need to create a client in multiple controllers,
 // try to use custom model binders
 private static Client CreateClient(string registrationToken)
 => string.IsNullOrWhiteSpace(registrationToken)
         ? Client.New()
         : Client.New(DeviceId.From(registrationToken));