Beispiel #1
0
        public ActionResult ShowBySlug(string catSlug, string Slug)
        {
            var cat = _categoryService.GetBySlug(catSlug);

            if (cat == null && !cat.IsProduct)
            {
                return(RedirectToAction("index", "Catergory"));
            }

            var topic = _productSevice.GetBySlug(Slug);

            if (topic == null || cat.Id != topic.Category_Id)
            {
                return(RedirectToAction("ShowBySlugProduct", "Category", new { slug = cat.Slug }));
            }

            ProductPost post = new ProductPost();

            if (topic.ProductPost_Id != null)
            {
                post = _productPostSevice.Get((Guid)topic.ProductPost_Id);
            }

            var model = new ProductViewModel
            {
                Cat     = cat,
                product = topic,
                post    = post
            };

            return(View(model));
        }