public async Task <IActionResult> LogoutAsync([FromServices] Core.AppContext appContext)
        {
            // Act.
            await _notificationService.UnregisterAsync(appContext.UserId);

            await _tokenService.RevokeRefreshTokenAsync(appContext.UserId);

            await _signInManager.SignOutAsync();

            // Return.
            return(NoContent());
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Create new instance.
 /// </summary>
 public UserController(Core.AppContext appContext,
                       IUserService userService,
                       UserUpdateHelper userUpdateHelper,
                       IEntityStorageUriService entityStorageUriService,
                       IMapper mapper)
 {
     _appContext              = appContext ?? throw new ArgumentNullException(nameof(appContext));
     _userService             = userService ?? throw new ArgumentNullException(nameof(userService));
     _userUpdateHelper        = userUpdateHelper ?? throw new ArgumentNullException(nameof(userUpdateHelper));
     _entityStorageUriService = entityStorageUriService ?? throw new ArgumentNullException(nameof(entityStorageUriService));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
        public async Task <IActionResult> DeleteAsync([FromServices] Core.AppContext appContext)
        {
            // TODO Copied from logout.
            // Act.
            await _notificationService.UnregisterAsync(appContext.UserId);

            await _tokenService.RevokeRefreshTokenAsync(appContext.UserId);

            await _signInManager.SignOutAsync();

            // Actually perform the delete operation.
            var user = await _userManager.GetUserAsync(User);

            await _userManager.DeleteAsync(user);

            // Return.
            return(NoContent());
        }
Exemplo n.º 4
0
        public IActionResult PostReaction([FromServices] DispatchManager dispatchManager, [FromServices] Core.AppContext appContext, [FromBody] ReactionDto input)
        {
            // Act.
            var postReactionContext = new PostReactionContext
            {
                IsPrivate    = input.IsPrivate,
                ReactionId   = input.Id,
                TargetVlogId = input.TargetVlogId,
                UserId       = appContext.UserId,
            };

            dispatchManager.Dispatch <PostReactionBackgroundTask>(postReactionContext);

            // Return.
            return(NoContent());
        }