Example #1
0
        public async Task <List <PostagesTimeLine> > GetTimeLineByUserId()
        {
            var userIdLogado = _logged.GetUserLoggedId();

            var postagesList = await _timeLineRepository
                               .GetTimeLine(userIdLogado)
                               .ConfigureAwait(false);

            foreach (var post in postagesList)
            {
                var likes = await _likesRepository
                            .GetQuantityOfLikesByPostageIdAsync(post.IdPost)
                            .ConfigureAwait(false);

                var comments = await _timeLineRepository
                               .GetCommentsAsync(post.IdPost)
                               .ConfigureAwait(false);

                if (comments != null)
                {
                    post.AddComments(comments);
                }
                if (likes > 0)
                {
                    post.AddLikes(likes);
                }
            }
            return(postagesList);
        }
 public async Task <int> GetQuantityOfLikesByPostageIdAsync(int postageId)
 {
     return(await _likesRepository
            .GetQuantityOfLikesByPostageIdAsync(postageId)
            .ConfigureAwait(false));
 }