public IActionResult Manage() { if (Request != null && Request.Cookies[Constants.COOKIE_NAME] != null) { var role = GetRoleFromCookie(); IEnumerable <Post> posts = new List <Post>(); switch (role) { case UserRoles.Writer: posts = _postsLogic.AllPostsByState(a => a.WorkflowStates == States.Draft || a.WorkflowStates == States.PendingApproval); break; case UserRoles.Editor: posts = _postsLogic.AllPostsByState(a => a.WorkflowStates == States.PendingApproval || a.WorkflowStates == States.Publish); break; } return(View(posts)); } return(RedirectToAction("Index", "Home")); }
public IActionResult Index() { var posts = _postsLogic.AllPostsByState(a => a.WorkflowStates == States.Publish); return(View(posts)); }
public IActionResult PendingPosts() { return(Ok(_postsLogic.AllPostsByState(a => a.WorkflowStates == States.PendingApproval))); }