public async Task <int> Send(SendPostRequest request)
        {
            Post postEntity = _mapper.Map <Post>(request);

            var postOwnerFeed =
                await _feedsRepository.GetOneAsync((feed) => feed.RelatedToUser == request.OwnerId);

            _feedsRepository.AddToFeed(ref postEntity, ref postOwnerFeed);

            _postsRepository.CreatePost(ref postEntity);
            await _postsRepository.SaveChangesAsync();

            return(postEntity.PostId);
        }
Exemplo n.º 2
0
        public async Task <FeedResponse> GetFeed(string userId)
        {
            var feedFromDb = await _repository.GetOneAsync((feed) => feed.RelatedToUser == userId);

            return(_mapper.Map <FeedResponse>(feedFromDb));
        }