public ActionResult CreateStaticPage(TinyMCEModelVM blogPostData)
 {
     StaticPage newPage = new StaticPage();
     newPage.PageTitle = blogPostData.Title;
     newPage.PageContent = blogPostData.Content;
     _mgr.AddStaticPage(newPage);
     return RedirectToAction("Index");
 }
        public ActionResult CreateBlogPost(TinyMCEModelVM blogPostData, string TagString)
        {
            string rawAuthorName = User.Identity.GetUserName();
            int indexToRemove = rawAuthorName.IndexOf("@");
            string authorName = rawAuthorName.Substring(0, indexToRemove);

            _mgr.AddBlogPost(blogPostData, TagString, authorName);

            return RedirectToAction("Index");
        }
        public void AddBlogPost(TinyMCEModelVM BlogPostData, string TagString, string authorName)
        {
            Blog blogPost = new Blog();
            blogPost.Tags = ConvertTagStringToList(TagString);
            blogPost.Title = BlogPostData.Title;
            blogPost.Author = authorName;
            blogPost.Content = BlogPostData.Content;
            blogPost.BlogDate = DateTime.Now;

            _repo.AddPost(blogPost);
        }
        public void AddBlogPostWorks()
        {
            var repo = new FakeBlogRepo();
            BlogManager mgr = new BlogManager(repo);

            var blogList = mgr.GetAllBlogs();

            TinyMCEModelVM blog = new TinyMCEModelVM();
            blog.Content = "This content is a test";

            blog.Title = "Tomato";
            string authorName = "Caleb";
            string blogTags = "#taco, #nachos, #apple";

            mgr.AddBlogPost(blog, blogTags, authorName);

            var newBlogList = mgr.GetAllBlogs();

            Assert.AreEqual(3, newBlogList.ElementAt(2).BlogId);
        }