Exemplo n.º 1
0
        public ActionResult Edit(string sitename, int querySetId)
        {
            bool foundSite = SetCommonQueryViewData(sitename);

            if (!foundSite)
            {
                return(PageNotFound());
            }

            SetHeader("Editing Query");

            QuerySet querySet = QueryUtil.GetFullQuerySet(querySetId);

            if (querySet == null)
            {
                return(PageNotFound());
            }

            ViewData["query_action"] = "save/" + Site.Id + "/" + querySetId;
            ViewData["HelperTables"] = HelperTableCache.GetCacheAsJson(Site);

            return(View("Editor", new ViewModel.QuerySetViewModel
            {
                Site = Site,
                Revisions = querySet.Revisions,
                CurrentRevision = querySet.CurrentRevision,
                QuerySet = querySet
            }));
        }
        public ActionResult Edit(string sitename, string operation, int querySetId, string slug)
        {
            Site site;

            if (!TryGetSite(sitename, out site))
            {
                return(site == null ? (ActionResult)PageNotFound() : RedirectPermanent(string.Format("/{0}/query/{1}/{2}{3}",
                                                                                                     site.TinyName.ToLower(), operation, querySetId, slug.HasValue() ? "/" + slug : ""
                                                                                                     )));
            }

            SetCommonQueryViewData(site, "Editing Query");

            QuerySet querySet = QueryUtil.GetFullQuerySet(querySetId);

            if (querySet == null)
            {
                return(PageNotFound());
            }

            ViewData["query_action"] = "save/" + Site.Id + "/" + querySetId;
            ViewData["HelperTables"] = HelperTableCache.GetCacheAsJson(Site);

            return(View("Editor", new ViewModel.QuerySetViewModel
            {
                Site = Site,
                Revisions = querySet.Revisions,
                CurrentRevision = querySet.CurrentRevision,
                QuerySet = querySet
            }));
        }
Exemplo n.º 3
0
        public ActionResult New(string sitename)
        {
            bool foundSite = SetCommonQueryViewData(sitename);

            if (!foundSite)
            {
                return(PageNotFound());
            }

            ViewData["query_action"] = "save/" + Site.Id;
            ViewData["HelperTables"] = HelperTableCache.GetCacheAsJson(Site);

            return(View("Editor", null));
        }
        public ActionResult New(string sitename)
        {
            Site site;

            if (!TryGetSite(sitename, out site))
            {
                return(site == null ? (ActionResult)PageNotFound() : RedirectPermanent(string.Format("/{0}/query/new",
                                                                                                     site.TinyName.ToLower()
                                                                                                     )));
            }

            SetCommonQueryViewData(site, "Viewing Query");

            ViewData["query_action"] = "save/" + Site.Id;
            ViewData["HelperTables"] = HelperTableCache.GetCacheAsJson(Site);

            return(View("Editor", null));
        }