public static string HeaderMenu(System.Web.Routing.RequestContext routingContext, RequestContext requestContext) { int linksPerRow = 9; int maxLinks = 9; int tabIndex = 0; int tempTabIndex = 0; //Find Categories to Display in Menu Catalog.CategoryRepository repo = Catalog.CategoryRepository.InstantiateForDatabase(requestContext); List <Catalog.CategorySnapshot> categories = repo.FindForMainMenu(); // Limit number of links int stopCount = categories.Count - 1; if ((maxLinks > 0) && ((maxLinks - 1) < stopCount)) { stopCount = (maxLinks - 1); } StringBuilder sb = new StringBuilder(); //Open List if (categories.Count > 0) { sb.Append("<ul>"); } tempTabIndex = tabIndex; //Build each Row for (int i = 0; i <= stopCount; i++) { sb.Append(BuildLink(categories[i], routingContext, ref tempTabIndex)); // Move to Next Row if Not Last Item int endOfRowCount = (i + 1) % linksPerRow; if ((endOfRowCount == 0) && (i < stopCount)) { sb.Append("</ul><ul>"); } } // Close List if (categories.Count > 0) { sb.Append("</ul>"); } return(sb.ToString()); }
public static bool IsCategorySlugInUse(string slug, string bvin, Catalog.CategoryRepository repository) { Catalog.Category c = repository.FindBySlug(slug); if (c != null) { if (c.Bvin != string.Empty) { if (c.Bvin != bvin) { return(true); } } } return(false); }
public static bool IsCategorySlugInUse(string slug, string bvin, RequestContext context) { Catalog.CategoryRepository repository = Catalog.CategoryRepository.InstantiateForDatabase(context); return(IsCategorySlugInUse(slug, bvin, repository)); }