Example #1
0
        public void SetTemplate(JSTemplate template)
        {
            var oldPage = db.Template.First(x => x.TemplateId == template.TemplateId);

            oldPage.Sources      = template.Sources;
            oldPage.TemplateJson = template.TemplateJson;
            db.SaveChanges();
        }
Example #2
0
        public async Task <IActionResult> SetTemplate([FromBody] JSTemplate template)
        {
            if (!this.HasRight("admintemplates"))
            {
                return(Unauthorized());
            }
            string token = this.GetToken();

            if (!db.IsAuthenticated(token))
            {
                return(Unauthorized());
            }
            var oldPage = db.GetTemplate(template.TemplateId);

            if (!this.CanDoPart(oldPage.PortalPartId))
            {
                return(Unauthorized());
            }
            db.SetTemplate(template);
            this.SaveUserAction(this.GetUserAction("Запис на страница", JObject.FromObject(template).ToString()));
            return(Ok());
        }