Advertisement
Ortund

Untitled

Apr 8th, 2014
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void DeletePost()
  2.     {
  3.         string result = String.Empty;
  4.  
  5.         try
  6.         {
  7.             var post = (from p in ne.posts
  8.                         where p.postid == postid
  9.                         select p).FirstOrDefault();
  10.             if (post != null)
  11.             {
  12.                 ne.DeleteObject(found);
  13.                 ne.SaveChanges();
  14.             }
  15.         }
  16.         catch (Exception ex)
  17.         {
  18.             lblErr.Text = String.Format("<p>An error occurred while trying to delete your post:</p><p>{0}</p>", ex.InnerException);
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement