コード例 #1
0
        /* RECENTLY VIEWED */
        internal void SetRecentlyViewedEvents()
        {
            var recentlyViewedEventEditions = EventServices.GetLastViewedEvents(CurrentCedUser.CurrentUser.UserId, 10).OrderBy(x => x.MasterName).ToList();

            recentlyViewedEventEditions = recentlyViewedEventEditions
                                          .GroupBy(x => x.EventId, (key, xs) => xs.OrderByDescending(x => x.Logo).First())
                                          .ToList();

            foreach (var recentlyViewedEventEdition in recentlyViewedEventEditions)
            {
                dynamic o = JsonConvert.DeserializeObject(recentlyViewedEventEdition.Logo);
                recentlyViewedEventEdition.Logo = o.WebLogoFileName;
            }

            var recentLogsModel = Mapper.Map <IList <EventEditionCustomType>, List <RecentViewListModel> >(recentlyViewedEventEditions);

            ViewBag.RecentViews = recentLogsModel;
        }