public void UpdatePageContent(ApplicationPageModel pageModel)
        {
            ContentApplicationPage contentpage = new ContentApplicationPage();
            ApplicationPage        page        = new ApplicationPage();

            page = applicationPageRepository.SingleOrDefault(r => r.ApplicationPageId == pageModel.ApplicationPageId);
            if (page != null)
            {
                page.PageTitle       = pageModel.PageTitle;
                page.PageUrl         = pageModel.PageUrl;
                page.IsActive        = pageModel.IsActive;
                page.PageDescription = pageModel.PageDescription;
                applicationPageRepository.Update(page);
            }
            if (pageModel.ContentApplicationPage.UseDefaultContent == true)
            {
                contentpage = contentApplicationRepository.SingleOrDefault(r => r.ApplicationPageId == pageModel.ApplicationPageId && r.CultureInformationId == pageModel.ContentApplicationPage.CultureInformationId);
                CultureInformation     cultureInformation = cultureInformationPageRepository.SingleOrDefault(r => r.IsDefault == true);
                ContentApplicationPage defaultContentPage = new ContentApplicationPage();
                defaultContentPage            = contentApplicationRepository.SingleOrDefault(r => r.CultureInformationId == cultureInformation.CultureInformationId && r.ApplicationPageId == pageModel.ApplicationPageId);
                contentpage.MetaDescription   = defaultContentPage.MetaDescription;
                contentpage.PageContent       = defaultContentPage.PageContent;
                contentpage.MetaTitle         = defaultContentPage.MetaTitle;
                contentpage.UseDefaultContent = true;
                contentApplicationRepository.Update(contentpage);
            }
            else
            {
                contentpage = contentApplicationRepository.SingleOrDefault(r => r.ApplicationPageId == pageModel.ApplicationPageId && r.CultureInformationId == pageModel.ContentApplicationPage.CultureInformationId);
                if (contentpage != null)
                {
                    contentpage.MetaDescription   = pageModel.ContentApplicationPage.MetaDescription;
                    contentpage.PageContent       = pageModel.ContentApplicationPage.PageContent;
                    contentpage.MetaTitle         = pageModel.ContentApplicationPage.MetaTitle;
                    contentpage.UseDefaultContent = false;
                    contentApplicationRepository.Update(contentpage);
                }
            }
        }
예제 #2
0
        public void SaveLanguage(CultureInformationModel cultureModel)
        {
            CultureInformation cultureInformation = cultureInformationRepository.SingleOrDefault(r => r.CultureInformationId == cultureModel.CultureInformationId);

            cultureInformation.IsActive = cultureModel.IsActive;
            cultureInformationRepository.Update(cultureInformation);
            List <ContentApplicationPage> contentPageList = new List <ContentApplicationPage>();
            List <ApplicationPage>        applicationPage = new List <ApplicationPage>();

            applicationPage = appliationPageRepository.GetAll(r => r.IsApplicationPage == true).ToList();
            foreach (var v in applicationPage)
            {
                ContentApplicationPage contentpage = new ContentApplicationPage();
                contentpage = contentApplicationPageRepository.SingleOrDefault(r => r.ApplicationPageId == v.ApplicationPageId && r.CultureInformationId == cultureModel.CultureInformationId);
                if (contentpage == null)
                {
                    contentpage = new ContentApplicationPage();
                    contentpage.ApplicationPageId    = v.ApplicationPageId;
                    contentpage.CultureInformationId = cultureModel.CultureInformationId;
                    contentpage.UseDefaultContent    = true;
                    contentApplicationPageRepository.Insert(contentpage);
                }
            }
        }