public TweetsModel convertToUI(Tweet tweet) { var listOfTweets = new TweetsModel(); listOfTweets.id_tweet = tweet.id_tweet; listOfTweets.id_user = (int)tweet.id_user; listOfTweets.Tweet = tweet.Tweet1; return listOfTweets; }
public Tweet convertToDal(TweetsModel tweet) { var listOfTweets = new Tweet(); listOfTweets.id_tweet = tweet.id_tweet; listOfTweets.id_user = tweet.id_user; listOfTweets.Tweet1 = tweet.Tweet; return listOfTweets; }
public bool Add(Tweet tweet) { using (var dbItem = new TwitterEntities()) { dbItem.Tweets.Add(tweet); return dbItem.SaveChanges() > 0; } }
public bool Save(Tweet tweet) { using (var dbItem = new TwitterEntities()) { dbItem.Tweets.Attach(tweet); dbItem.Entry(tweet).State = EntityState.Modified; return dbItem.SaveChanges() > 0; } }
private MasterEntities AddToContext(MasterEntities context, Tweet entity, int count, int commitCount, bool recreateContext) { context.Tweets.Add(entity); if (count % commitCount == 0) { context.SaveChanges(); if (recreateContext) { context.Dispose(); context = CreateContext(); } } return context; }
public void CreateTweet(Tweet tweet) { tweets.Add(tweet); }