public IQueryable <ServiceSubcategory> GetSubcategories() { IQueryable <ServiceSubcategory> list; switch (sectionName) { case "personal": list = _servicesServices.GetSubcategoriesList(LanguageId, categoryId.Value).Where(s => s.HasPersonalServices).AsQueryable(); break; case "business": list = _servicesServices.GetSubcategoriesList(LanguageId, categoryId.Value).Where(s => s.HasBusinessServices).AsQueryable(); break; default: list = _servicesServices.GetSubcategoriesList(LanguageId, categoryId.Value).Where(s => s.HasPersonalServices || s.HasPersonalServices).AsQueryable(); break; } return(list);// _servicesServices.GetSubcategoriesList(LanguageId, categoryId.Value).Where(s => s.Sections.Contains(typeId.ToString()) || s.Sections == "1").AsQueryable(); }
private int typeId = 1;//2=personal 3=business public services() { TryGetRouteParameter("Section", out sectionName); TryGetRouteParameter("UrlName", out urlName); TryGetRouteParameter("CategoryUrlName", out categoryUrlName); TryGetRouteParameter("SubcategoryId", out subcategoryId); _servicesServices = new ServicesServices(); var subCategoy = _servicesServices.GetSubcategoriesList(LanguageId).First(s => s.Id == subcategoryId.Value); SubcategoryName = subCategoy.Name; CategoryName = subCategoy.ServiceCategory.Name; categoryId = subCategoy.ServiceCategory.Id; }
public IQueryable <ServiceSubcategory> GetSubcategories([Control] int?ddlCategories) { return(ddlCategories.HasValue? _servicesServices.GetSubcategoriesList(LanguageId, ddlCategories.Value).Where(s => s.Services.Any()).OrderBy(s => s.ServiceCategory.Id).AsQueryable() : _servicesServices.GetSubcategoriesList(LanguageId).Where(s => s.Services.Any()).OrderBy(s => s.ServiceCategory.Id).AsQueryable()); }