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); } }
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); } }
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); } }
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); } }