Пример #1
0
 public async Task <JsonResult> SavePagina([FromBody] Page page, string token)
 {
     if (await Seguranca.validaTokenAsync(token))
     {
         Page pagina = new Page();
         if (page.idCliente != 0)
         {
             if (PageDAO.Save(page))
             {
                 return(Json("Pagina salva com sucesso"));
             }
             else
             {
                 return(Json("Encontramos algum problema ao salvar a pagina. Entre em contato com o suporte"));
             }
         }
         else
         {
             return(Json("Encontramos algum problema ao salvar a pagina. Entre em contato com o suporte"));
         }
     }
     else
     {
         return(Json("Você nao tem acesso neste plugin"));
     }
 }
Пример #2
0
        public void EditPageTest()
        {
            var obj = PageDAO.GetAll().Find(x => x.ID == 1);

            obj.Nome      = "Teste3";
            obj.Descricao = "Teste3";
            obj.Conteudo  = "Teste3";

            var result = PageDAO.Save(obj);
        }
Пример #3
0
        public ActionResult Edit_Post(string id, string pageTitle, string pageFriendlyURL, string published)
        {
            Page Page = new Page();

            bool SavedIt = false;

            try
            {
                if (!string.IsNullOrWhiteSpace(id))
                {
                    Page = PageDAO.LoadByBsonId(id);
                }
                else
                {
                    Page.CreateDefaultNewPage();
                }

                Page.PageTitle       = pageTitle;
                Page.PageFriendlyURL = pageFriendlyURL;
                Page.Published       = Boolean.Parse(published);

                Page PageFriendlyURLExists = PageDAO.LoadByURL(Page.PageFriendlyURL);

                //can only save if another page type does not have the same page friendly url
                if (PageFriendlyURLExists == null || PageFriendlyURLExists.PageId.Equals(Page.PageId))
                {
                    SavedIt = true;

                    AddWebUserMessageToSession(Request, String.Format("Successfully saved/updated page."), SUCCESS_MESSAGE_TYPE);

                    PageDAO.Save(Page);
                }
                else
                {
                    AddWebUserMessageToSession(Request, String.Format("Unable to save page, there is already a page type published with the friendly URL \"{0}\"", Page.PageFriendlyURL), FAILED_MESSAGE_TYPE);
                }
            }
            catch (Exception e)
            {
                Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.PageController.Edit_Post()" + e.Message);
            }

            //if we were trying to add a new page and were unable to save it
            if (string.IsNullOrWhiteSpace(id) && !SavedIt)
            {
                return(RedirectToAction("Dashboard", "Home"));
            }

            return(RedirectToAction("ViewPageHistory", "Page", new { pageId = Page.PageId }));
        }
Пример #4
0
        public ActionResult Editor_Save(string pageData)
        {
            Page Page = new Page();

            try
            {
                Page = JsonConvert.DeserializeObject <Page>(pageData);

                Page.Published = false;

                PageDAO.Save(Page);
            }
            catch (Exception e)
            {
                Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.PageController.Editor_Save()" + e.Message);
            }

            return(RedirectToAction("ViewPageHistory", "Page", new { pageId = Page.PageId }));
        }
Пример #5
0
        public void CreatePageTest()
        {
            var page = new Page
            {
                Nome           = "Teste3",
                Descricao      = "Teste3",
                Titulo         = "Teste3",
                Url            = "Teste3",
                Conteudo       = "Teste3",
                UsuarioCriacao = 1,
                UsuarioEdicao  = 1,
                DataCriacao    = DateTime.Now,
                DateAlteracao  = DateTime.Now,
                Ativo          = true.ToString(),
                Status         = 1
            };

            var result = PageDAO.Save(page);
        }