public virtual MainCoursesVM GetMainCourses() { var allRootSections = SectionVMService.GetSectionWithEntityTree(); var professions = ProfessionService.GetAll() .OrderByName().IsActive().ToDictionary(x => x.Profession_ID, x => x); var professionSections = SiteObjectRelationService.GetRelation(typeof(Profession), Enumerable.Empty <object>(), typeof(Section)).ToList(); var sectionIds = new HashSet <int>(professionSections.Select(x => x.RelationObject_ID).Cast <int>()); var sectionForProfession = allRootSections.Select(x => x.Entity.As <Section>()).Where(x => sectionIds.Contains(x.Section_ID)); return (new MainCoursesVM { Products = ProductService.GetAll() .OrderByName().IsActive().ToList(), SiteTerms = SiteTermService.GetAll() .OrderByName().IsActive().ToList(), Professions = sectionForProfession.Select(x => EntityWithList.New(x, professionSections.Where(sor => sor.RelationObject_ID.Equals(x.Section_ID)) .Select(y => professions.GetValueOrDefault((int)y.Object_ID)) .Cast <IEntityCommonInfo>().Where(p => p != null))).ToList(), RootSections = allRootSections, Vendors = VendorService.GetAll() .OrderByName().IsActive().ToList(), }); }
public virtual ActionResult List() { var result = new List <object>(); result.AddRange(SiteTermService.GetAll().IsActive().Cast <object>()); result.AddRange(ProductService.GetAll().IsActive().Cast <object>()); result.AddRange(ProfessionService.GetAll().IsActive().Cast <object>()); result.AddRange(VendorService.GetAll().IsActive().Cast <object>()); return(View(result.OrderBy(o => o.GetValue("Name")))); }
public virtual ActionResult Definition(string urlName) { var model = SiteTermService.GetAll().ByUrlName(urlName); if (model == null) { return(null); } if (model.SiteTerm_ID == Sections.Terms.Webinar) { ViewBag.Seminars = CourseListVMService.ProbWebinars(); } return(MView(ViewNames.CommonEntityPage, model)); }
public virtual MainPageVM Get() { var sections = SectionService.GetAll().IsActive().Where(s => s.ForMainPage) .ByWebOrder().ToList(); var professions = ProfessionService.GetAll().IsActive() .Where(p => p.ForMainPage).ToList() .OrderBy(x => StringUtils.IsBasicLetter(x.Name.First())).ThenBy(x => x.Name).ToList(); var vendors = VendorService.GetAll().IsActive() .Where(p => p.ForMainPage).ByWebOrder().ToList(); var products = ProductService.GetAll().IsActive() .Where(p => p.ForMainPage).ToList().OrderBy(x => x.Name).ToList(); var siteterms = SiteTermService.GetAll().IsActive() .Where(p => p.ForMainPage).ToList().OrderBy(x => x.Name).ToList(); VideoService.LoadWith(x => x.VideoCategory); var videos = VideoService.GetAll(x => x.CategoryId == VideoCategories.CoursePresentation) .OrderByDescending(x => x.UpdateDate).Take(3).ToList(); return (new MainPageVM { Professions = professions, Vendors = vendors, Sections = sections, Products = products, Banners = BannerService.GetBanner(CommonConst.SiteRoot + "/") .ShufflePriority(x => x.Priority), News = NewsService.GetAllForMain().ToList(), SiteTerms = siteterms, Videos = videos, Documents = CertTypeService .GetAll(c => CertTypes.ForMain.Contains(c.UrlName)).ToList(), About = SimplePageService.GetAll().BySysName(SimplePages.MainPage) }); }