Example #1
0
        public IActionResult Index(int page = 1, string cat = "")
        {
            var pageModel = new PagePostModel();

            pageModel.Category = _categoryBlogService.GetAll(CurrentLang);

            var model = _postService.GetPagedAll(page, 3, publishDate: true, lang: CurrentLang, cat: cat);

            pageModel.MixPost = model.Results;

            foreach (var item in pageModel.Category)
            {
                var posts = _postService.GetPagedAll(page, 4, publishDate: true, lang: CurrentLang, cat: item.Slug);
                if (pageModel.Posts is null)
                {
                    pageModel.Posts = posts.Results;
                }
                else
                {
                    var tmp = pageModel.Posts.ToList();
                    foreach (var post in posts.Results)
                    {
                        tmp.Add(post);
                    }
                    pageModel.Posts = tmp;
                }
            }

            ViewBag.cat      = cat;
            ViewBag.UrlImage = _webImageService.GetAll(Data.Enum.Position.BreadcrumbNews).FirstOrDefault()?.URLImage;

            return(View(pageModel));
        }
        public IActionResult Index(string slug)
        {
            var model = _pageContentService.GetPageSlug(slug);

            ViewBag.UrlImage = _webImageService.GetAll(Data.Enum.Position.BreadcrumbFAQ).FirstOrDefault()?.URLImage;
            return(View(model));
        }
        public IActionResult Index()
        {
            var model = _groupQuestionService.GetAll(lang: base.CurrentLang);

            ViewBag.UrlImage = _webImageService.GetAll(Data.Enum.Position.BreadcrumbFAQ).FirstOrDefault()?.URLImage;
            return(View(model));
        }
        public IActionResult Index(string function = "", string sector = "")
        {
            var model = new CatalogModel();

            model.CatalogFunctions = _catalogFunctionService.GetAll(CurrentLang);
            model.CatalogSectors   = _catalogSectorService.GetAll(CurrentLang);
            ViewBag.color          = "";
            if (!string.IsNullOrWhiteSpace(function))
            {
                model.Products = _productService.GetProductByFunction(function);
                model.Title    = model.CatalogFunctions.Where(x => x.Slug == function).FirstOrDefault().Name;
                ViewBag.color  = model.CatalogFunctions.Where(x => x.Slug == function).FirstOrDefault().Color;
            }

            else if (!string.IsNullOrWhiteSpace(sector))
            {
                model.Products = _productService.GetProductBySector(sector);
                model.Title    = model.CatalogSectors.Where(x => x.Slug == sector).FirstOrDefault().Name;
                ViewBag.color  = model.CatalogSectors.Where(x => x.Slug == sector).FirstOrDefault().Color;
            }

            else
            {
                model.Products = _productService.GetAll(CurrentLang);
                model.Title    = "Tất cả";
            }

            ViewBag.UrlImage = _webImageService.GetAll(Data.Enum.Position.BreadcrumbProduct).FirstOrDefault()?.URLImage;

            return(View(model));
        }
Example #5
0
        public IActionResult Index()
        {
            var model = _infoService.GetAll(Data.Enum.InfoType.InfoCompay);

            ViewBag.UrlImage = _webImageService.GetAll(Data.Enum.Position.BreadcrumbContact).FirstOrDefault()?.URLImage;
            return(View(model));
        }
Example #6
0
        public IActionResult Index()
        {
            var model = new HomeModel();

            model.Images = _webImageService.GetAll(Data.Enum.Position.HomeSlide);

            model.PostsHot         = _postService.GetAll(CurrentLang, 2, true, active: true, publishDate: true);
            model.CatalogFunctions = _catalogFunctionService.GetAll(CurrentLang, true, true);
            model.Logos            = _webImageService.GetAll(Data.Enum.Position.Logo);

            foreach (var item in model.CatalogFunctions)
            {
                item.Product = item.Product.Where(x => x.New == true).ToList();
            }

            model.CatalogSectors = _catalogSectorService.GetAll(CurrentLang, true, true);

            foreach (var item in model.CatalogSectors)
            {
                item.Product = item.Product.Where(x => x.New == true).ToList();
            }

            model.Category = _categoryBlogService.GetAll(CurrentLang);

            foreach (var item in model.Category)
            {
                var posts = _postService.GetPagedAll(1, 4, publishDate: true, lang: CurrentLang, cat: item.Slug);
                if (model.Posts is null)
                {
                    model.Posts = posts.Results;
                }
                else
                {
                    var tmp = model.Posts.ToList();
                    foreach (var post in posts.Results)
                    {
                        tmp.Add(post);
                    }
                    model.Posts = tmp;
                }
            }

            return(View(model));
        }
Example #7
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var model = await Task.Run(() => _webImageService.GetAll(Data.Enum.Position.Logo));

            return(View("_PartnerBanner", model));
        }
        public IActionResult Get()
        {
            var model = _webImageService.GetAll();

            return(Ok(model));
        }