Esempio n. 1
0
        public static void DeletePost(int id)
        {
            EditablePost postToDelete = GetEditablePost(id);

            if (postToDelete != null)
            {
                DeleteChildPosts(postToDelete);
            }
        }
Esempio n. 2
0
        static void DeleteChildPosts(EditablePost post)
        {
            List <EditablePost> childPosts = GetEditableChildPosts(post.PostID);

            if (childPosts != null)
            {
                foreach (EditablePost childPost in childPosts)
                {
                    DeleteChildPosts(childPost);
                }
            }
            GetEditablePosts().Remove(post);
        }
Esempio n. 3
0
        public static void UpdatePost(EditablePost post)
        {
            EditablePost postToUpdate = GetEditablePost(post.PostID);

            if (postToUpdate != null)
            {
                postToUpdate.Subject       = post.Subject;
                postToUpdate.From          = post.From;
                postToUpdate.PostDate      = post.PostDate;
                postToUpdate.Text          = post.Text;
                postToUpdate.IsNew         = post.IsNew;
                postToUpdate.HasAttachment = post.HasAttachment;
            }
        }
Esempio n. 4
0
 public ActionResult InlineEditingUpdatePostPartial(EditablePost post)
 {
     if (ModelState.IsValid)
     {
         try {
             NewsGroupsProvider.UpdatePost(post);
         }
         catch (Exception e) {
             ViewData["EditNodeError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditNodeError"] = "Please, correct all errors.";
     }
     return(PartialView("InlineEditingPartial", NewsGroupsProvider.GetEditablePosts()));
 }
Esempio n. 5
0
 public static void InsertPost(EditablePost newPost)
 {
     newPost.PostID = GetNewEditablePostID();
     GetEditablePosts().Add(newPost);
 }