예제 #1
0
 public List <Tweet> SearchTweets(string searchKey)
 {
     try
     {
         TweetDataAccess tweetDB = new TweetDataAccess();
         return(tweetDB.SearchTweets(searchKey));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
 public List <Tweet> GetTweets()
 {
     try
     {
         int             id      = Convert.ToInt32(User.Identity.Name);
         TweetDataAccess tweetDB = new TweetDataAccess();
         return(tweetDB.GetTweets(id));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
        public object UserProfile(int userID)
        {
            try
            {
                int id = Convert.ToInt32(User.Identity.Name);

                UserDataAccess userDB = new UserDataAccess();
                DetailedUser   user   = userDB.GetDetailedUser(userID, id);

                TweetDataAccess tweetDB = new TweetDataAccess();
                List <Tweet>    tweets  = tweetDB.GetTweetsByUser(userID);

                return(new { User = user, Tweets = tweets });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public Tweet AddTweet(string tweetContent)
        {
            try
            {
                int id = Convert.ToInt32(User.Identity.Name);
                loggedInUser = new UserDataAccess().GetUser(id);

                Tweet tweet = new Tweet();
                tweet.TweetedBy     = loggedInUser.ID;
                tweet.Content       = tweetContent;
                tweet.TweetedOn     = DateTime.Now;
                tweet.TweetedByName = loggedInUser.Name;

                TweetDataAccess tweetDB = new TweetDataAccess();
                tweetDB.AddTweet(tweet);

                return(tweet);               //JsonConvert.SerializeObject(tweet);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }