using System;
using System.Web.Mvc;
using Qusion.Cms.Site.Core;
using Qusion.Cms.Web.Extensions;
using Qusion.Cms.Web.Mvc;
using Qusion.WebApp.Areas.Qusion.Filters;

namespace Qusion.WebApp.Areas.Qusion.Controllers
{
   // [QusionAuthorize(LoginPage = "/qusion/account/login")]
    public class PageController : Controller
    {
        private readonly PageService _pageService;

        public PageController(PageService pageService)
        {
            _pageService = pageService;
        }

        public ActionResult Content(Guid id)
        {
            var page = _pageService.GetById(id);
            var model = new CmsPageContext(CmsPageContextMode.Edit).Build(page);

            ViewBag.Title = page.Title;

            return View(CmsPageHelper.CmsPagePath(page.GuidID), model);
        }

        public ActionResult Toolbox()
        {
            return View();
        }
    }
}