コード例 #1
0
        public static EditablePost GetEditedPost(TreeListEditFormTemplateContainer container)
        {
            var post = new EditablePost
            {
                From          = (string)DataBinder.Eval(container.DataItem, "From"),
                Subject       = (string)DataBinder.Eval(container.DataItem, "Subject"),
                PostDate      = (DateTime)(DataBinder.Eval(container.DataItem, "PostDate") ?? new DateTime()),
                Text          = (string)DataBinder.Eval(container.DataItem, "Text"),
                HasAttachment = (bool?)DataBinder.Eval(container.DataItem, "HasAttachment"),
                IsNew         = (bool?)DataBinder.Eval(container.DataItem, "IsNew"),
                ParentID      = (int?)DataBinder.Eval(container.DataItem, "ParentID")
            };
            var postId = DataBinder.Eval(container.DataItem, "PostID");

            int postIdToExcludeFromParentList = postId != null
                ? (int)DataBinder.Eval(container.DataItem, "PostID")
                : -1;

            post.PostLookups.Add(new PostLookup(0, ""));

            post.PostLookups.AddRange(NewsGroupsProvider.GetEditablePosts()
                                      .Where(p => p.PostID != postIdToExcludeFromParentList)
                                      .Select(p => new PostLookup(p.PostID, p.From)));

            return(post);
        }
コード例 #2
0
 public ActionResult InlineEditingWithTemplateAddNewPostPartial(EditablePost post)
 {
     if (ModelState.IsValid)
     {
         NewsGroupsProvider.InsertPost(post);
     }
     else
     {
         ViewData["EditNodeError"] = "Please, correct all errors.";
     }
     return(InlineEditingWithTemplatePartial());
 }
コード例 #3
0
        public ActionResult InlineEditingWithTemplateMovePostPartial(int postID, int?parentID, bool hierarchy)
        {
            if (hierarchy)
            {
                NewsGroupsProvider.MovePost(postID, parentID);
            }
            else
            {
                NewsGroupsProvider.ReOrderPost(postID, parentID);
            }

            return(InlineEditingWithTemplatePartial());
        }
コード例 #4
0
 public ActionResult InlineEditingWithTemplateUpdatePostPartial(EditablePost post)
 {
     if (ModelState.IsValid)
     {
         NewsGroupsProvider.UpdatePost(post);
         if (post.ParentID != null)
         {
             NewsGroupsProvider.MovePost(post.PostID, post.ParentID);
         }
     }
     else
     {
         ViewData["EditNodeError"] = "Please, correct all errors.";
     }
     return(InlineEditingWithTemplatePartial());
 }
コード例 #5
0
 public ActionResult InlineEditingWithTemplateDeletePostPartial(int postID)
 {
     NewsGroupsProvider.DeletePost(postID);
     return(InlineEditingWithTemplatePartial());
 }
コード例 #6
0
        public ActionResult InlineEditingWithTemplatePartial()
        {
            var posts = NewsGroupsProvider.GetEditablePosts();

            return(PartialView("../Partial/InlineEditingWithTemplatePartial", posts));
        }