Ejemplo n.º 1
0
        public async Task <ActionResult <IEnumerable <CommentPostModel> > > GetCommentPostModel(string userId)
        {
            if (userId == null)
            {
                return(NotFound());
            }

            var commentPostModel = await _commentPostServices.GetCommentByUserAsync(userId);

            if (commentPostModel == null)
            {
                return(NotFound());
            }

            return(commentPostModel.ToList());
        }
Ejemplo n.º 2
0
        public async Task DeleteAsync(string id)
        {
            var postagens = await _postServices.GetPostsByUserAsync(id);

            var comentarios = await _commentPostRepository.GetCommentByUserAsync(id);

            var likes = await _likePostRepository.GetLikeByUserAsync(id);

            var amigos = await _amigosRepository.GetAllByUserAsync(id);

            var user = await _usuarioRepository.GetByIdAsync(id);

            foreach (var post in postagens)
            {
                await _postServices.DeleteAsync(post.Id, post.UriImage);
            }

            foreach (var comentario in comentarios)
            {
                await _commentPostRepository.DeleteAsync(comentario.Id);
            }

            foreach (var like in likes)
            {
                await _likePostRepository.DeleteAsync(like.Id);
            }

            foreach (var amigo in amigos)
            {
                await _amigosRepository.DeleteAsync(amigo.Id);
            }

            await _blobServices.DeleteBlobAsync(user.FotoPerfil);

            await _usuarioRepository.DeleteAsync(id);
        }