コード例 #1
0
 /// <summary>
 /// Получение SEO настроек
 /// </summary>
 /// <param name="page"></param>
 /// <returns></returns>
 public SeoLang GetSeoSettings(EnumSitePage page)
 {
     using (var db = new DataContext())
     {
         var seoRu = db.SeoDescriptionLanguages.Include(x => x.SeoDescription)
                     .FirstOrDefault(x => x.LanguageId == EnumLanguage.ru && x.SeoDescriptionId == page);
         var seoRo = db.SeoDescriptionLanguages.Include(x => x.SeoDescription)
                     .FirstOrDefault(x => x.LanguageId == EnumLanguage.ro && x.SeoDescriptionId == page);
         var result = new SeoLang()
         {
             Id              = page,
             Ru_Title        = seoRu.Title,
             Ru_Keywords     = seoRu.Keywords,
             Ru_Description  = seoRu.Description,
             Ru_PageContent  = seoRu.PageContent,
             Ru_ExtraContent = seoRu.ExtraContent,
             Ro_Title        = seoRo.Title,
             Ro_Keywords     = seoRo.Keywords,
             Ro_Description  = seoRo.Description,
             Ro_PageContent  = seoRo.PageContent,
             Ro_ExtraContent = seoRo.ExtraContent
         };
         return(result);
     }
 }
コード例 #2
0
 /// <summary>
 /// Обновление SEO настроек
 /// </summary>
 /// <param name="seo"></param>
 public void UpdateSeoSettings(SeoLang seo)
 {
     using (var db = new DataContext())
     {
         var seoRu = db.SeoDescriptionLanguages
                     .FirstOrDefault(x => x.SeoDescriptionId == seo.Id && x.LanguageId == EnumLanguage.ru);
         var seoRo = db.SeoDescriptionLanguages
                     .FirstOrDefault(x => x.SeoDescriptionId == seo.Id && x.LanguageId == EnumLanguage.ro);
         seoRu.Title        = seo.Ru_Title;
         seoRu.Keywords     = seo.Ru_Keywords;
         seoRu.Description  = seo.Ru_Description;
         seoRu.PageContent  = seo.Ru_PageContent;
         seoRu.ExtraContent = seo.Ru_ExtraContent;
         seoRo.Title        = seo.Ro_Title;
         seoRo.Keywords     = seo.Ro_Keywords;
         seoRo.Description  = seo.Ro_Description;
         seoRo.PageContent  = seo.Ro_PageContent;
         seoRo.ExtraContent = seo.Ro_ExtraContent;
         db.SaveChanges();
     }
 }
コード例 #3
0
 public ActionResult Index(SeoLang seo)
 {
     AdminServices.Modules.UpdateSeoSettings(seo);
     return(RedirectToAction("index", "index"));
 }