示例#1
0
 /// <summary>
 /// 触发页面切换事件
 /// </summary>
 public void OnPageSwitchEvent(ContentPages switchToPage)
 {
     if (null != PageSwitchEvent)
     {
         PageSwitchEvent(switchToPage);
     }
 }
示例#2
0
        public ContentResult Sitemap()
        {
            SitemapLib.Sitemap sitemap = new SitemapLib.Sitemap();
            string             host    = Request.Url.Scheme + "://" + Request.Url.Host;
            Random             random  = new Random();

            //Add regular pages
            foreach (ContentPageBasicViewModel page in ContentPages.Pages())
            {
                if (page.IncludeInSitemap)
                {
                    sitemap.AddLocation(host + page.VirtualPath, DateTime.Today, "0." + random.Next(3, 9).ToString(), ChangeFrequency.Monthly);
                }
            }

            //Add blog post pages
            TKS.Areas.Admin.Models.Blog.BlogPosts blogPosts = new TKS.Areas.Admin.Models.Blog.BlogPosts("en-US");
            foreach (TKS.Areas.Admin.Models.Blog.BlogPostViewModel blogPost in blogPosts.EveryPost())
            {
                sitemap.AddLocation(host + blogPost.URL, blogPost.PublishDate, "0." + random.Next(3, 9).ToString(), ChangeFrequency.Yearly);
            }

            //Add News pages
            TKS.Areas.Admin.Models.CMS.NewsSet newsSet = new TKS.Areas.Admin.Models.CMS.NewsSet();
            foreach (TKS.Areas.Admin.Models.CMS.NewsModel news in newsSet.News())
            {
                sitemap.AddLocation(host + news.URL, news.DateReleased, "0." + random.Next(3, 9).ToString(), ChangeFrequency.Never);
            }


            Response.ContentType = "text/xml";

            return(Content(sitemap.GenerateSitemapXML()));
        }
示例#3
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ContentPages contentPages = await db.ContentPages.FindAsync(id);

            db.ContentPages.Remove(contentPages);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#4
0
        public async Task <ActionResult> Create([Bind(Include = "Id,PageName,PageDescription,PageCode,Sort,CreatedDate,UpdatedDate,Description")] ContentPages contentPages)
        {
            if (ModelState.IsValid)
            {
                db.ContentPages.Add(contentPages);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(contentPages));
        }
示例#5
0
        /// <summary>
        /// 窗体切换内容页
        /// </summary>
        /// <param name="switchToPage"></param>
        private void MainWindow_PageSwitchEvent(ContentPages switchToPage)
        {
            switch (switchToPage)
            {
            case ContentPages.Achievement:
                if (null != achievement)
                {
                    mainContent.Content = achievement;
                }
                else
                {
                    mainContent.Content = new Achievement();
                }
                break;

            case ContentPages.Chapters:
                if (null != chapters)
                {
                    mainContent.Content = chapters;
                }
                else
                {
                    mainContent.Content = new Chapters();
                }
                break;

            case ContentPages.Questions:
                if (null != questions)
                {
                    mainContent.Content = questions;
                }
                else
                {
                    mainContent.Content = new Questions();
                }
                break;

            case ContentPages.AnswerQuestion:
                if (null != questionEidtor)
                {
                    mainContent.Content = questionEidtor;
                }
                else
                {
                    mainContent.Content = new MathEidtor();
                }
                break;

            default:
                break;
            }
        }
示例#6
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,PageName,PageDescription,PageCode,CreatedDate")] ContentPages contentPages)
        {
            if (ModelState.IsValid)
            {
                contentPages.UpdatedDate = DateTime.Now;

                db.Entry(contentPages).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(contentPages));
        }
示例#7
0
        // GET: ContentPages/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ContentPages contentPages = await db.ContentPages.FindAsync(id);

            if (contentPages == null)
            {
                return(HttpNotFound());
            }
            return(View(contentPages));
        }
示例#8
0
        public ActionResult Create(ContentPageViewModel contentPage)
        {
            Guid PageID = ContentPages.Add(contentPage);

            return(Redirect("/admin/pages/edit/" + PageID.ToString() + "#tabs-4"));
        }
示例#9
0
        // GET: Admin/Pages
        public ActionResult Index()
        {
            List <ContentPageViewModel> pages = ContentPages.Pages();

            return(View(pages));
        }