Exemplo n.º 1
0
 public void AddTweet(Tweet objTweet)
 {
     try
     {
         using (TweetContext objContext = new TweetContext())
         {
             objContext.Tweets.Add(objTweet);
             objContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 public void AddUser(Client objUser)
 {
     try
     {
         using (TweetContext objContext = new TweetContext())
         {
             objContext.Clients.Add(objUser);
             objContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public void EditTweet(Tweet objTweet)
 {
     try
     {
         using (TweetContext objContext = new TweetContext())
         {
             objContext.Tweets.Attach(objTweet);
             objContext.Entry(objTweet).State = System.Data.Entity.EntityState.Modified;
             objContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
 public Tweet FindTweet(int id)
 {
     try
     {
         using (TweetContext objContext = new TweetContext())
         {
             var query = (from obj in objContext.Tweets
                          where obj.tweet_id == id
                          select obj).FirstOrDefault();
             return(query);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 5
0
 public void DeleteTweet(int id)
 {
     try
     {
         using (TweetContext objContext = new TweetContext())
         {
             var query = (from obj in objContext.Tweets
                          where obj.tweet_id == id
                          select obj).FirstOrDefault();
             objContext.Tweets.Remove(query);
             objContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
 public bool VerifyUser(string username, string password)
 {
     try
     {
         using (TweetContext objContext = new TweetContext())
         {
             var NoOfUsers = (from obj in objContext.Clients
                              where obj.user_id == username && obj.password == password
                              select obj).Count();
             if (NoOfUsers > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }