// api/Tweets public ActionResult GetTweets() { // Repositorydeki metodu çağırıp dto için mapping yaptık. // Çünkü kullanıcının bazı alanları görmemesi gerekir. var tweets = _appRepository.GetTweets().ToList(); List <UserTweetInfoDto> _listOfuti = new List <UserTweetInfoDto>(); foreach (var tweet in tweets) { var user = _appRepository.GetUser(tweet.userIdFk); UserTweetInfoDto _uti = new UserTweetInfoDto() { userId = user.userId, loginName = user.loginName, userName = user.userName, userSurname = user.userSurname, userImageUrl = user.imageUrl, tweetContent = tweet.tweetContent, tweetDate = tweet.tweetDate, tweetId = tweet.tweetId }; _listOfuti.Add(_uti); } return(Ok(_listOfuti)); }
public ActionResult GetTweetAndUserInfo(int uid, int tid) { var user = _appRepository.GetUser(uid); var tweet = _appRepository.GetSelectedTweet(tid); UserTweetInfoDto _utInfo = new UserTweetInfoDto() { userId = user.userId, loginName = user.loginName, userName = user.userName, userSurname = user.userSurname, userImageUrl = user.imageUrl, tweetId = tweet.tweetId, tweetContent = tweet.tweetContent, tweetDate = tweet.tweetDate }; return(Ok(_utInfo)); }