SHOW:
|
|
- or go back to the newest paste.
| 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); |
| 12 | + | ne.DeleteObject(post); |
| 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 | } |