public ActionResult Add(int id)
        {
            var post = _postLogic.GetPost(id);

            ViewBag.Post = post;
            var comment = new Comment {
                PostId = id
            };

            return(View(comment));
        }
Example #2
0
        public IActionResult ChangePostState(int postId, string action, string approver)
        {
            var post = _postsLogic.GetPost(postId);

            if (post.WorkflowStates == States.PendingApproval && actions.Contains(action))
            {
                post.WorkflowStates = action.Equals("approve") ? States.Publish : States.Draft;
                post.Approver       = approver;
                post.ApprovalDate   = DateTime.Now;
                _postsLogic.AddOrEdit(post);
                return(Ok(post));
            }
            return(BadRequest());
        }
        public IActionResult Single(int id)
        {
            var Post = _postsLogic.GetPost(id);

            return(View(Post));
        }