public ActionResult Experts(string selectedTags, string country, string searchTags) { var query = Company.ActiveCompanies(Tenant.Id, DbContext).LoadRelated(c => c.Tags, c => c.Account); if (country != UIHelper.ALL_COUNTRIES) { query = query.Where(c => c.Country.ToLower() == country.Trim().ToLower()); } if (!string.IsNullOrEmpty(selectedTags)) { var tagIds = selectedTags.Split(new char[] { ',' }).Where(t => !string.IsNullOrEmpty(t)).Select(id => long.Parse(id)).ToList(); query = query.Where(c => c.Tags.Any(t => tagIds.Contains(t.Id))); } var companies = query.OrderByDescending(c => c.Id).ToList(); return(View <Experts>(GetViewName("Experts"), v => { v.TopMenuSelectedItem = TopMenuSelection.SEARCH_COMPANIES; v.Companies = companies; v.SelectedCountry = country; v.SelectedTagIds = selectedTags; v.SelectedTags = searchTags; })); }
public ActionResult Index() { return(View <HomePage>(GetViewName("Index"), v => { var recentCompanies = Company.ActiveCompanies(Tenant.Id, DbContext).LoadRelated(c => c.Account, c => c.Tags) .Where(c => c.Account.Rating > 0); //Of these, select the ones who have a picture/logo var withLogos = recentCompanies.Where(c => (c.Type == COMPANY_TYPE.COMPANY && c.Logo != DEFAULT_IMAGES.COMPANY_LOGO) || (c.Type == COMPANY_TYPE.INDIVIDUAL && c.Logo != DEFAULT_IMAGES.PROFILE_PICTURE)).Take(30) .OrderByDescending(c => c.Portfolio.Count) .OrderByDescending(c => c.Account.DateAdded) .OrderByDescending(c => c.Account.Rating) .ToList(); // var withoutLogos = recentCompanies.Except(withLogos); v.Pane1 = new List <Company>(); v.Pane2 = new List <Company>(); if (withLogos.Count() > 1) { var parts = withLogos.Split(2).ToList(); v.Pane1.AddRange(parts[0]); v.Pane2.AddRange(parts[1]); } })); }
// // GET: /Search/ public ActionResult Experts() { var companies = Company.ActiveCompanies(Tenant.Id, DbContext).LoadRelated(c => c.Tags, c => c.Account) .OrderByDescending(c => c.Id).ToList(); return(View <Experts>(GetViewName("Experts"), v => { v.TopMenuSelectedItem = TopMenuSelection.SEARCH_COMPANIES; v.Companies = companies; })); }