Esempio n. 1
0
        public LangOutputModel(text source)
        {
            foreach (String lang in Helpers.LangHelper.langs)
            {
                texts_value entity = source.texts_values.SingleOrDefault(x => x.culture == lang);

                this.setByCulture(
                    lang,
                    (entity == null ? String.Empty : entity.value)
                );
            }
        }
Esempio n. 2
0
        public long add(PageInputModel input)
        {
            using (LangDataContext dataContext = new LangDataContext())
            {
                page p = new page();

                text title = new text();
                text content = new text();

                dataContext.pages.InsertOnSubmit(p);
                dataContext.texts.InsertOnSubmit(title);
                dataContext.texts.InsertOnSubmit(content);

                p.text = title;
                p.text1 = content;

                foreach (PageInputModel.Page newPage in input.request)
                {
                    texts_value titleValue = new texts_value();
                    titleValue.culture = newPage.lang;
                    titleValue.value = newPage.data.title;
                    titleValue.text = title;
                    titleValue.seo_value = this._app.makeAlias(newPage.data.title);

                    texts_value contentValue = new texts_value();
                    contentValue.culture = newPage.lang;
                    contentValue.value = newPage.data.content;
                    contentValue.text = content;

                    dataContext.texts_values.InsertOnSubmit(titleValue);
                    dataContext.texts_values.InsertOnSubmit(contentValue);
                }

                dataContext.SubmitChanges();

                return p.id;

            }
        }
Esempio n. 3
0
 partial void Deletetext(text instance);
Esempio n. 4
0
 partial void Updatetext(text instance);
Esempio n. 5
0
 partial void Inserttext(text instance);
Esempio n. 6
0
        public long add(CategoryInputModel input)
        {
            using (LangDataContext dataContext = new LangDataContext())
            {
                category c = new category();

                text title = new text();
                text content = new text();

                dataContext.categories.InsertOnSubmit(c);
                dataContext.texts.InsertOnSubmit(title);
                dataContext.texts.InsertOnSubmit(content);

                c.text = content;
                c.title = title;

                foreach (CategoryInputModel.Category cat in input.request)
                {
                    texts_value titleValue = new texts_value();
                    titleValue.culture = cat.lang;
                    titleValue.value = cat.data.Title;
                    titleValue.text = title;
                    titleValue.seo_value = this._app.makeAlias(cat.data.Title);

                    texts_value contentValue = new texts_value();
                    contentValue.culture = cat.lang;
                    contentValue.value = cat.data.Content;
                    contentValue.text = content;

                    dataContext.texts_values.InsertOnSubmit(titleValue);
                    dataContext.texts_values.InsertOnSubmit(contentValue);
                }

                c.parentid = input.catParent;
                c.date = DateTime.Now;

                dataContext.SubmitChanges();

                return c.id;

            }
        }