// The id parameter name should match the DataKeyNames value set on the control
        public void GridViewBookmarks_DeleteItem(int bookmarkId)
        {
            BookmarksEntities context = new BookmarksEntities();
            Bookmark bookmark = context.Bookmarks.Find(bookmarkId);

            context.Bookmarks.Remove(bookmark);
            context.SaveChanges();
            ErrorSuccessNotifier.AddInfoMessage("Bookmark successfully deleted.");
            this.GridViewBookmarks.PageIndex = 0;
            
        }
        protected void LinkButtonSaveBookmark_Click(object sender, EventArgs e)
        {
            using (BookmarksEntities context = new BookmarksEntities())
            {
                Bookmark bookmark;
                if (isNewBookmark)
                {
                    bookmark = new Bookmark();
                    context.Bookmarks.Add(bookmark);
                }
                else
                {
                    bookmark = context.Bookmarks.Find(this.bookmarkId);
                }

                try
                {
                    bookmark.Title = this.TextBoxBookmarkTitle.Text;
                    bookmark.URL = this.TextBoxBookmarkURL.Text;
                    bookmark.DateOfCreation = DateTime.Now;

                    context.SaveChanges();

                    ErrorSuccessNotifier.AddInfoMessage("Bookmark " + (this.isNewBookmark ? "created." : "edited."));

                    ErrorSuccessNotifier.ShowAfterRedirect = true;
                    Response.Redirect("EditBookmarks.aspx", false);


                }
                catch (Exception ex)
                {
                    ErrorSuccessNotifier.AddErrorMessage(ex);
                }
            }
        }