Esempio n. 1
0
        public async Task <ActionResult> load()
        {
            var json   = new StreamReader(Request.Body).ReadToEnd();
            var entity = JsonConvert.DeserializeObject <AttrTemplateEntity>(json);

            if (!entity.skip_template)
            {
                var _templates = await AttrTemplatesBLL.LoadItems(_context, entity);

                foreach (var item in _templates)
                {
                    item.sections = await AttrTemplatesSectionsBLL.LoadItems(_context, new AttrTemplateSectionEntity()
                    {
                        templateid = item.id, order = "priority desc"
                    });
                }

                return(Ok(new { posts = _templates }));
            }
            else
            {
                var _sections = await AttrTemplatesSectionsBLL.LoadItems(_context, new AttrTemplateSectionEntity()
                {
                    attr_type = entity.attr_type, order = "priority desc"
                });

                return(Ok(new { posts = _sections }));
            }
        }
Esempio n. 2
0
        public async Task <ActionResult> delete_template()
        {
            var json  = new StreamReader(Request.Body).ReadToEnd();
            var items = JsonConvert.DeserializeObject <List <JGN_Attr_Templates> >(json);

            foreach (var item in items)
            {
                await AttrTemplatesBLL.Delete(_context, item.id);
            }

            return(Ok(new { status = "success", message = SiteConfig.generalLocalizer["_record_deleted"].Value }));
        }
Esempio n. 3
0
        public async Task <ActionResult> proc_template()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <JGN_Attr_Templates>(json);

            if (data.id > 0)
            {
                await AttrTemplatesBLL.Update(_context, data);
            }
            else
            {
                data = await AttrTemplatesBLL.Add(_context, data);
            }

            return(Ok(new { status = "success", record = data, message = SiteConfig.generalLocalizer["_record_created"].Value }));
        }