public ActionResult Edit(EventAddress eventAddress, string exhibitorSlug) { var userAuthenticated = userService.GetUser(User.Identity.Name); if (userAuthenticated == null || !userAuthenticated.IsInRole("Admin")) { return(null); } var slug = exhibitorSlug.CleanSlug(); Exhibitor exhibitor; if (slug.Equals("New")) { exhibitor = new Exhibitor(Guid.Empty); } else { var exhibitorFilterCriteria = new ExhibitorFilterCriteria { Term = slug }; var result = exhibitorService.GetExhibitors(eventAddress, exhibitorFilterCriteria); exhibitor = result.SingleOrDefault(); } if (exhibitor == null) { return(null); } return(View(new OxiteViewModelItem <Exhibitor>(exhibitor))); }
public IPageOfItems <Exhibitor> GetExhibitors(EventAddress eventAddress, ExhibitorFilterCriteria exhibitorFilterCriteria) { var pageIndex = 0; var pageSize = 50; if (context.RequestDataFormat == RequestDataFormat.Web) { pageIndex = exhibitorFilterCriteria.PageIndex; pageSize = exhibitorFilterCriteria.PageSize; } var varyBy = string.Join(",", exhibitorFilterCriteria.ParticipantLevels.ToArray()).Trim(); if (!string.IsNullOrEmpty(exhibitorFilterCriteria.Term)) { varyBy = exhibitorFilterCriteria.Term.Trim(); } return (cache.GetItems <IPageOfItems <Exhibitor>, Exhibitor>( string.Format("GetExhibitors-Event:{0}-{1}", eventAddress != null ? eventAddress.EventName ?? "" : "", varyBy), new CachePartition(pageIndex, pageSize), () => repository.GetExhibitors(eventAddress, exhibitorFilterCriteria).GetPage(pageIndex, pageSize), e => e.GetDependencies() )); }
public Exhibitor GetExhibitor(EventAddress eventAddress, string name) { var exhibitorFilterCriteria = new ExhibitorFilterCriteria { Term = name }; var exhibitor = repository.GetExhibitors(eventAddress, exhibitorFilterCriteria) .FirstOrDefault(); return(exhibitor); }
public ActionResult Sponsors(EventAddress eventAddress, int pageIndex, int pageSize) { var @event = eventService.GetEvent(eventAddress); var criteria = new ExhibitorFilterCriteria { Event = @event, ParticipantLevels = new[] { "Platinum", "Gold", "Silver" }, PageIndex = pageIndex, PageSize = pageSize }; var exhibitors = exhibitorService.GetExhibitors(eventAddress, criteria); return(View(new OxiteViewModelItems <Exhibitor>(exhibitors))); }
public ActionResult Exhibitors(EventAddress eventAddress, int pageIndex, int pageSize) { var @event = eventService.GetEvent(eventAddress); var criteria = new ExhibitorFilterCriteria { Event = @event, PageIndex = pageIndex, PageSize = pageSize }; var exhibitors = exhibitorService.GetExhibitors(eventAddress, criteria); return(View(new OxiteViewModelItems <Exhibitor>(exhibitors))); }
public IQueryable <Exhibitor> GetExhibitors(EventAddress eventAddress, ExhibitorFilterCriteria exhibitorFilterCriteria) { IQueryable <oxite_Conferences_Exhibitor> query = from e in context.oxite_Conferences_Exhibitors orderby e.Name select e; if (exhibitorFilterCriteria != null && exhibitorFilterCriteria.Event != null) { query = query.Where( e => e.EventID == exhibitorFilterCriteria.Event.ID ); } if (exhibitorFilterCriteria != null && !String.IsNullOrEmpty(exhibitorFilterCriteria.Term)) { var slug = exhibitorFilterCriteria.Term.CleanSlug(); var lookup = query.ToList().ToDictionary(e => e.Name.CleanSlug(), e => e.Name); var name = lookup.ContainsKey(slug) ? lookup[slug] : null; if (name != null) { query = query.Where( e => e.Name.Equals(name) ); } else { // 404 return(new List <Exhibitor>(0).AsQueryable()); } } if (exhibitorFilterCriteria != null && exhibitorFilterCriteria.ParticipantLevels.Count() > 0) { var levels = exhibitorFilterCriteria.ParticipantLevels.ToArray(); query = query.Where(e => levels.Contains(e.ParticipantLevel)); } var list = query.OrderBy(e => e.ParticipantLevel).Select(e => projectExhibitor(e)); return(list); }