Пример #1
0
        public async Task DeleteUserAsync()
        {
            var userId = _logged.GetUserLoggedId();

            var checkIfUserExist = await _userRepository
                                   .GetByIdAsync(userId)
                                   .ConfigureAwait(false);



            if (checkIfUserExist != null)
            {
                await _likesRepository
                .DeleteAsyncByUser(userId)
                .ConfigureAwait(false);

                await _commentRepository
                .DeleteByIdUserAsync(userId)
                .ConfigureAwait(false);

                await _postageRepository
                .DeleteAsync(userId)
                .ConfigureAwait(false);



                await _friendsRepository
                .DeleteByFriendIdAsync(userId)
                .ConfigureAwait(false);

                await _friendsRepository
                .DeleteByIdAsync(userId)
                .ConfigureAwait(false);


                await _userRepository
                .DeleteAsync(userId)
                .ConfigureAwait(false);
            }
            else
            {
                throw new ArgumentException("Pessoa não localizada");
            }
        }