/// <summary> /// Looks up the category by its slug and returns the category name, if found /// </summary> /// <param name="slugText"></param> /// <returns></returns> private string LookupCategory(string slugText) { var categoryText = string.Empty; if (!string.IsNullOrEmpty(slugText)) { CustomUrl customUrl; var category = HccApp.ParseCategoryBySlug(slugText, out customUrl); if (category != null) { categoryText = category.Name; } } return(categoryText); }
private CategoryPageViewModel LoadCategoryModel(string slug, string preContentColumnId, string postContentColumnId) { Category cat = null; if (!string.IsNullOrWhiteSpace(slug)) { CustomUrl customUrl; cat = HccApp.ParseCategoryBySlug(slug, out customUrl); if (customUrl != null && !IsConcreteItemModule) { var redirectUrl = HccUrlBuilder.RouteHccUrl(HccRoute.Category, new { slug = customUrl.RedirectToUrl }); if (customUrl.IsPermanentRedirect) { Response.RedirectPermanent(redirectUrl); } else { Response.Redirect(redirectUrl); } } if (cat == null) { StoreExceptionHelper.ShowInfo(Localization.GetString("CategoryNotFound")); } else if (!HccApp.CatalogServices.TestCategoryAccess(cat)) { StoreExceptionHelper.ShowInfo(Localization.GetString("CategoryNotEnoughPermission")); } } else { cat = new Category { Bvin = string.Empty, PreContentColumnId = preContentColumnId, PostContentColumnId = postContentColumnId }; } return(new CategoryPageViewModel { LocalCategory = cat }); }