public ActionResult CreateStaticPage(TinyMCEModelVM blogPostData)
 {
     StaticPage newPage = new StaticPage();
     newPage.PageTitle = blogPostData.Title;
     newPage.PageContent = blogPostData.Content;
     _mgr.AddStaticPage(newPage);
     return RedirectToAction("Index");
 }
        public void AddStaticPageWorks()
        {
            var repo = new FakeBlogRepo();
            BlogManager mgr = new BlogManager(repo);

            StaticPage page = new StaticPage();

            page.PageTitle = "DayZ";
            page.PageContent = "This is a zombie page";
            page.IsEnabled = true;

            mgr.AddStaticPage(page);

            var staticPageList = mgr.GetAllStaticPages();

            Assert.AreEqual(3, staticPageList.Count());
            Assert.True(staticPageList.ElementAt(2).PageTitle == "DayZ");
            Assert.True(staticPageList.ElementAt(2).PageId == 3);
        }
Example #3
0
        //static pages
        public void AddStaticPage(StaticPage NewPage)
        {
            using (var cn = new SqlConnection(Settings.ConnectionString))
            {
                var cmd = new SqlCommand();
                cmd.CommandText = "AddNewStaticPage";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@PageTitle", NewPage.PageTitle);
                cmd.Parameters.AddWithValue("@PageContent", NewPage.PageContent);
                //need to find a way to attach multiple tags

                try
                {
                    cmd.Connection = cn;
                    cn.Open();
                    cmd.ExecuteNonQuery();
                }

                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public void AddStaticPage(StaticPage NewPage)
        {
            var staticPageList = GetAllStaticPages();
            int staticPageIdCount = staticPageList.Max(x => x.PageId);

            NewPage.PageId = staticPageIdCount + 1;

            _staticPages.Add(NewPage);
        }
Example #5
0
        private StaticPage AssignStaticPagesDataFromDR(SqlDataReader dr)
        {
            StaticPage StaticPageNew = new StaticPage();

            StaticPageNew.PageId = (int)dr["PageId"];
            StaticPageNew.PageTitle= dr["PageTitle"].ToString();
            StaticPageNew.PageContent = dr["PageContent"].ToString();
            StaticPageNew.IsEnabled = (bool)dr["IsEnabled"];
            return StaticPageNew;
        }
 //Post Data to Sql
 public void AddStaticPage(StaticPage newPage)
 {
     _repo.AddStaticPage(newPage);
 }