Exemple #1
0
        public async Task <TweetResponse> CreateTweet(
            TweetRequest tweetRequest, string userId)
        {
            var tweet = _mapper.Map <TweetRequest, Tweet>(tweetRequest);

            tweet.UserID         = userId;
            tweet.CreationDate   = DateTime.UtcNow;
            tweet.LastTimeOfEdit = tweet.CreationDate;

            await _tweetsRepository.CreateTweet(tweet);

            var tweetDto = _mapper.Map <Tweet, TweetResponse>(tweet);

            return(tweetDto);
        }