Ejemplo n.º 1
0
        public ActionResult AddBlogPost(BlogPost blogPost)
        {
            var ops = new BlogPostOperations();
            if (User.IsInRole("Admin"))
            {
                // Admin add post, post goes to table with status of 1
                ops.AddNewBlogPost(blogPost);
                return RedirectToAction("Index", "Home");
            }
            if (User.IsInRole("PR"))
            {
                // PR add post, post goes to table with status of 0
                ops.PRAddNewBlogPost(blogPost);
                return RedirectToAction("Index", "Home");
            }

            // somehow a non-authenticated add. nothing goes to data. (necessary?)
            return RedirectToAction("Index", "Home");
        }