コード例 #1
0
        public ActionResult Delete(PermissionArea Area, PermissionPost Post)
        {
            var currentUser = userSession.GetCurrent();
            var interop = Post.ToInterop(Area.Entity, currentUser);

            ViewData["Post"] = interop;
            ViewData["Salt"] = "PostDelete";

            return View("FormDelete", Area);
        }
コード例 #2
0
        public ActionResult Delete(PermissionArea Area, PermissionPost Post, ApType ApType, string Action)
        {
            if (String.IsNullOrWhiteSpace(Action) ||
                !Action.Equals("Yes"))
            {
                return RedirectToAction("View", "Blog", new
                {
                    postid = Post.Entity.ID,
                    title = Post.Entity.Title.ToUrlFriendly()
                });
            }

            middleManagement.Post.Delete(Post.Entity);

            return RedirectToAction("Index", "Blog", new
            {
                page = 1
            });
        }
コード例 #3
0
        public ActionResult Reply(PermissionArea Area, PermissionPost Post, ApType ApType, CommentEdit CommentEdit)
        {
            if (!ModelState.IsValid)
            {
                var postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);

                ViewData["Post"] = postEdit;
                ViewData["Comment"] = CommentEdit;
                ViewData["Salt"] = "CommentReply";

                return View("FormComment", Area);
            }

            var comment = Mapper.Map<CommentEdit, Comment>(CommentEdit);

            var permissionComment = middleManagement.Comment.Add(comment);

            return Redirect(Url.Action("View", "Blog",
                                    new
                                    {
                                        postid = Post.Entity.ID,
                                        title = Post.Entity.Title.ToUrlFriendly()
                                    }) + string.Format("#{0}", permissionComment.Entity.ID));
        }
コード例 #4
0
        public ActionResult Reply(PermissionArea Area, PermissionPost Post, ApType ApType)
        {
            var postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);

            ViewData["Post"] = postEdit;
            ViewData["Comment"] = new CommentEdit();
            ViewData["Salt"] = "CommentReply";

            return View("FormComment", Area);
        }
コード例 #5
0
        public ActionResult Rank(PermissionPost Post, short rank)
        {
            var value = 0;
            if (rank > 1)
            {
                rank = 1;
            }

            if (rank < -1)
            {
                rank = -1;
            }

            if (rank != 0)
            {
                //update rank
                value = middleManagement.Post.Rank(Post.Entity, rank);
            }
            else
            {
                // return current
                value = Post.Entity.Rank;
            }

            return RedirectToAction("View", "Blog", new
            {
                postid = Post.Entity.ID,
                title = Post.Entity.Title.ToUrlFriendly()
            });
        }
コード例 #6
0
        public ActionResult Edit(PermissionArea Area, PermissionPost Post, CommentEdit CommentEdit, ApType ApType)
        {
            if (!ModelState.IsValid)
            {
                var postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);

                ViewData["Post"] = postEdit;
                ViewData["Comment"] = CommentEdit;
                ViewData["Salt"] = "PostComment";

                return View("FormComment", Area);
            }

            var commentToSave = Mapper.Map<CommentEdit, Comment>(CommentEdit);
            middleManagement.Comment.Save(commentToSave);

            return RedirectToAction("View", "Blog", new
            {
                postid = Post.Entity.ID,
                title = Post.Entity.Title.ToUrlFriendly()
            });
        }
コード例 #7
0
        public ActionResult Edit(PermissionArea Area, PermissionPost Post, PermissionEntity<Comment> Comment)
        {
            var postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);
            var commentEdit = Mapper.Map<Comment, CommentEdit>(Comment.Entity);

            ViewData["Post"] = postEdit;
            ViewData["Comment"] = commentEdit;
            ViewData["Salt"] = "CommentEdit";

            return View("FormComment", Area);
        }
コード例 #8
0
        public ActionResult Edit(PermissionArea Area, PermissionPost Post, ApType ApType)
        {
            PostEdit postEdit;

            switch (ApType)
            {
                case ApType.blog:
                    postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("ApType");
            }

            ViewData["Post"] = postEdit;
            ViewData["Salt"] = "PostEdit";

            return View("Form" + ApType.ToProper(), Area);
        }