Ejemplo n.º 1
0
 public void AddTweet(Tweet objTweet)
 {
     try
     {
         using (var objcontext = new MVCSBAEntities())
         {
             objcontext.Tweets.Add(objTweet);
             objcontext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
 public void AddUser(Person objUser)
 {
     try
     {
         using (var objcontext = new MVCSBAEntities())
         {
             objcontext.Persons.Add(objUser);
             objcontext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
 public void EditTweet(Tweet objTweet)
 {
     try
     {
         using (MVCSBAEntities objcontext = new MVCSBAEntities())
         {
             objcontext.Tweets.Attach(objTweet);
             objcontext.Entry(objTweet).State = System.Data.Entity.EntityState.Modified;
             objcontext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 4
0
 public void DeleteTweet(int id)
 {
     try
     {
         using (MVCSBAEntities objcontext = new MVCSBAEntities())
         {
             var Query = (from obj in objcontext.Tweets
                          where obj.TweetID == id
                          select obj).FirstOrDefault();
             objcontext.Tweets.Remove(Query);
             objcontext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }