Exemple #1
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;

            }
        }
Exemple #2
0
 partial void Deletepage(page instance);
Exemple #3
0
 partial void Updatepage(page instance);
Exemple #4
0
 partial void Insertpage(page instance);
Exemple #5
0
		private void detach_pages1(page entity)
		{
			this.SendPropertyChanging();
			entity.text1 = null;
		}
Exemple #6
0
		private void attach_pages1(page entity)
		{
			this.SendPropertyChanging();
			entity.text1 = this;
		}
Exemple #7
0
        private PageListOutputModel getPOM(page p)
        {
            PageListOutputModel pom = new PageListOutputModel();
            pom.Id = p.id;

            LangOutputModel title = new LangOutputModel();
            LangOutputModel content = new LangOutputModel();

            foreach (string lang in Helpers.LangHelper.langs)
            {
                title.setByCulture(lang, p.text.texts_values.Single(x => x.culture == lang).value);
                content.setByCulture(lang, p.text1.texts_values.Single(x => x.culture == lang).value);
            }

            pom.Title = title;
            pom.Content = content;

            return pom;
        }