Esempio n. 1
0
 public List <TweetEntity> GetFollowingTweetDtls(PersonEntity personDetails)
 {
     try
     {
         List <TweetEntity> poDetails;
         using (var Connection = new TwitterApplicationEntities())
         {
             poDetails = (from t in Connection.TWEETs
                          join p in Connection.FOLLOWINGs on t.user_id equals p.following_id
                          where p.user_id == personDetails.user_id
                          select new TweetEntity
             {
                 tweet_id = t.tweet_id,
                 user_id = t.user_id,
                 message = t.message,
                 created = t.created
             }).ToList();
         }
         return(poDetails);
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }
Esempio n. 2
0
 public List <PersonEntity> GetUserDetails()
 {
     try
     {
         List <PersonEntity> poDetails;
         using (var Connection = new TwitterApplicationEntities())
         {
             poDetails = (from p in Connection.People
                          select new PersonEntity
             {
                 user_id = p.user_id,
                 password = p.password,
                 fullName = p.fullName,
                 email = p.email,
                 joined = p.joined,
                 active = p.active
             }).ToList();
         }
         return(poDetails);
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }
Esempio n. 3
0
 public string AddUser(PersonEntity personDetails)
 {
     try
     {
         var person = new PERSON()
         {
             user_id  = personDetails.user_id,
             password = personDetails.password,
             fullName = personDetails.fullName,
             email    = personDetails.email,
             joined   = personDetails.joined,
             active   = personDetails.active
         };
         using (var Connection = new  TwitterApplicationEntities())
         {
             Connection.People.Add(person);
             Connection.SaveChanges();
         }
         return("Person Added Successfully");
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }
Esempio n. 4
0
 public string DeleteTweet(TweetEntity tweets)
 {
     try
     {
         using (var Connection = new TwitterApplicationEntities())
         {
             Connection.Entry(tweets).State = EntityState.Deleted;
             Connection.SaveChanges();
         }
         return("Tweet Deleted Successfully");
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }
Esempio n. 5
0
 public string AddFollower(FollowingEntity followerDetails)
 {
     try
     {
         var person = new FOLLOWING()
         {
             user_id      = followerDetails.user_id,
             following_id = followerDetails.following_id
         };
         using (var Connection = new TwitterApplicationEntities())
         {
             Connection.FOLLOWINGs.Add(person);
             Connection.SaveChanges();
         }
         return("Follower Added Successfully");
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }
Esempio n. 6
0
 public List <FollowingEntity> GetFollowerDetails(FollowingEntity followerDetails)
 {
     try
     {
         List <FollowingEntity> poDetails;
         using (var Connection = new TwitterApplicationEntities())
         {
             poDetails = (from p in Connection.FOLLOWINGs
                          where p.following_id == followerDetails.user_id
                          select new FollowingEntity
             {
                 user_id = p.user_id,
                 following_id = p.following_id
             }).ToList();
         }
         return(poDetails);
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }
Esempio n. 7
0
 public string UpdateTweet(TweetEntity tweets)
 {
     try
     {
         var person = new TWEET()
         {
             tweet_id = tweets.tweet_id,
             user_id  = tweets.user_id,
             message  = tweets.message,
             created  = tweets.created
         };
         using (var Connection = new TwitterApplicationEntities())
         {
             Connection.TWEETs.Add(person);
             Connection.SaveChanges();
         }
         return("Tweet Updated Successfully");
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }
Esempio n. 8
0
 public List <TweetEntity> GetTweetsDetails(PersonEntity personDetails)
 {
     try
     {
         List <TweetEntity> poDetails;
         using (var Connection = new TwitterApplicationEntities())
         {
             poDetails = (from p in Connection.TWEETs
                          where p.user_id == personDetails.user_id
                          select new TweetEntity
             {
                 tweet_id = p.tweet_id,
                 user_id = p.user_id,
                 message = p.message,
                 created = p.created
             }).ToList();
         }
         return(poDetails);
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }