Exemple #1
0
        public IViewComponentResult Invoke(SeoType Type, int Id, string Title = null, string Des = null, string Img = null)
        {
            var        model = new SeoModel();
            ISeoDomain seo   = null;

            if (Id == 0)
            {
                return(View(new SeoModel()
                {
                    TitleSEO = Title, DescriptionSEO = Des, ImageSEO = Img
                }));
            }
            Type typeSer = null;

            switch (Type)
            {
            case SeoType.Home:
                typeSer = typeof(IInfoService);
                break;

            case SeoType.Category:
                typeSer = typeof(ICateService);
                break;

            case SeoType.Detail:
                typeSer = typeof(IProductService);
                break;

            case SeoType.Discount:
            {
                Title   = "Sản phẩm khuyến mãi";
                typeSer = typeof(IInfoService);
                break;
            }

            case SeoType.Search:
            {
                Title   = "Kết quả tìm kiếm";
                typeSer = typeof(IInfoService);
                break;
            }
            }
            if (typeSer != null)
            {
                var service = (ISeoService)HttpContext.RequestServices.GetService(typeSer);
                seo = service.GetSeo(Id);
            }
            if (seo != null)
            {
                model.TitleSEO       = Title ?? seo.SeoTitle;
                model.DescriptionSEO = Des ?? seo.SeoDescription;
                model.ImageSEO       = Img ?? seo.SeoImage;
            }
            return(View(model));
        }
 public CategoryEditViewModel()
 {
     Seo = new SeoModel();
 }
 public PostEditViewModel()
 {
     Seo = new SeoModel();
 }
Exemple #4
0
 public LoadModel()
 {
     SeoModel = new SeoModel();
 }