Esempio n. 1
0
        public ActionResult SeoMng(int id)
        {
            if (IsValidSessions())
            {
                string description = string.Empty;
                var viewModel = new viewModelServiceSeo();

                var serviceGroup = _RService.ServiceGroups.FirstOrDefault(_ => _.Id == id);
                var servicetabs = _RService.ServiceTabs.Where(_ => _.ServiceGroupId == id).ToList();

                if (!string.IsNullOrEmpty(serviceGroup.metaDescription))
                {
                    viewModel.metaDescription = serviceGroup.metaDescription;
                }
                else
                {
                    description = StripHTML(servicetabs[0].TabTypeText);
                    viewModel.metaDescription = description.Length > 1000 ? description.Substring(0, 1000) : description.Substring(0, description.Length);

                }

                if (!string.IsNullOrEmpty(serviceGroup.Title))
                {
                    viewModel.title = serviceGroup.Title;

                }
                else
                {
                    viewModel.title = serviceGroup.Name;
                }

                viewModel.id = id;

                if (string.IsNullOrEmpty(serviceGroup.keywords))
                {
                    foreach (var tab in servicetabs)
                    {
                        if (!string.IsNullOrEmpty(tab.Tags))
                            viewModel.keyWords += tab.Tags + ",";
                    }
                }
                else
                {
                    viewModel.keyWords = serviceGroup.keywords;
                }

                return View(viewModel);
            }
            else
                return RedirectToAction("Login", "Home");
        }
Esempio n. 2
0
        public ActionResult SeoMng()
        {
            var result = new viewModelServiceSeo();

            if (IsValidSessions())
            {
                if (Convert.ToInt32(Session["Language"]) == 1)
                {
                    var setting = _RSetting.Settings.FirstOrDefault(x => x.LanguageId == 1);
                    var homeSeo = _RSeoMng.ReadSeoMang("/home");
                    if(homeSeo != null)
                    {
                          if(!string.IsNullOrEmpty(homeSeo.title))
                          {
                              result.title = homeSeo.title;
                          }
                          else
                          {
                              result.title = " ";
                          }

                        if(!string.IsNullOrEmpty(homeSeo.metaDescription))
                        {
                            result.metaDescription = homeSeo.metaDescription;
                        }
                        else
                        {
                            result.metaDescription = StripHTML(setting.CompanyIntroduce ?? " ");
                        }

                        if(!string.IsNullOrEmpty(homeSeo.keywords))
                        {
                            result.keyWords = homeSeo.keywords;
                        }
                        else
                        {
                            result.keyWords = " ";
                        }
                    }
                    else
                    {
                        result.title = " ";
                        result.metaDescription = StripHTML(setting.CompanyIntroduce ?? " ");
                        result.keyWords = " ";
                    }
                }
                else //english
                {
                    //var faqSeo = _RSeoMng.ReadSeoMang("/en/home");
                    var Setting = _RSetting.Settings.FirstOrDefault(x => x.LanguageId == 2);

                        result.title = "  | HomePage";
                        result.metaDescription = StripHTML(Setting.CompanyIntroduce ?? " ");
                        result.keyWords = " ";

                }

                return View(result);
            }

                return RedirectToAction("Login", "Home");
        }
Esempio n. 3
0
        public ActionResult ContactInfoSeoMng()
        {
            var result = new viewModelServiceSeo();

            if (IsValidSessions())
            {
                if (Convert.ToInt32(Session["Language"]) == 1)
                {
                    var contactInfo = _RContactInfo.ContactInfos.FirstOrDefault(_ => _.LanguageId == 1);
                    var seo = _RSeoMng.ReadSeoMang("/contactinfo");
                    if (seo != null)
                    {
                        if (!string.IsNullOrEmpty(seo.title))
                        {
                            result.title = seo.title;
                        }
                        else
                        {
                            result.title = " ";
                        }

                        if (!string.IsNullOrEmpty(seo.metaDescription))
                        {
                            result.metaDescription = seo.metaDescription;
                        }
                        else
                        {
                            result.metaDescription = contactInfo.Address ?? " ";
                        }

                        if (!string.IsNullOrEmpty(seo.keywords))
                        {
                            result.keyWords = seo.keywords;
                        }
                        else
                        {
                            result.keyWords = "";
                        }
                    }
                    else
                    {
                        result.title = "";
                        result.metaDescription = contactInfo.Address ?? " ";
                        result.keyWords = "";
                    }
                }
                else //english
                {
                    var seo = _RSeoMng.ReadSeoMang("/en/contactinfo");
                    var contactInfo = _RContactInfo.ContactInfos.FirstOrDefault(_ => _.LanguageId == 2);
                    if (seo != null)
                    {
                        if (!string.IsNullOrEmpty(seo.title))
                        {
                            result.title = seo.title;
                        }
                        else
                        {
                            result.title = "  | Contact Us";
                        }

                        if (!string.IsNullOrEmpty(seo.metaDescription))
                        {
                            result.metaDescription = seo.metaDescription;
                        }
                        else
                        {
                            result.metaDescription = contactInfo.Address ?? " ";
                        }

                        if (!string.IsNullOrEmpty(seo.keywords))
                        {
                            result.keyWords = seo.keywords;
                        }
                        else
                        {
                            result.keyWords = "";
                        }
                    }
                    else
                    {
                        result.title = "  | ContactUs";
                        result.metaDescription = contactInfo.Address ?? " ";
                        result.keyWords = "";
                    }
                }

                return View("SeoMng",result);
            }
            else
                return RedirectToAction("Login", "Home");
        }