Пример #1
0
        public IEnumerable <TeamMemberDTO> LoadCreativeTeam(
            string languageCode, int performanceId)
        {
            var mapper = new MapperConfiguration(
                cfg => cfg.CreateMap <DAL.Models.TeamMember, TeamMemberDTO>())
                         .CreateMapper();
            IEnumerable <DAL.Models.TeamMember> creativeTeam = null;
            string cacheKey = GetCacheKey(languageCode, performanceId);

            if (!memoryCache.TryGetValue(cacheKey, out creativeTeam))
            {
                creativeTeam = creativeTeamRepository.GetCreativeTeam(languageCode, performanceId);
                memoryCache.Set(cacheKey, creativeTeam);
            }

            return(mapper.Map <IEnumerable <DAL.Models.TeamMember>, IEnumerable <TeamMemberDTO> >(creativeTeam));
        }
Пример #2
0
        public PerformanceDetailsBaseDTO LoadPerformanceDetails(string Accountid, string languageCode, int performanceId)
        {
            var cacheProvider = new CacheProvider(memoryCache);

            var isChecked = isCheckedPerformanceRepository.IsChecked(Accountid, performanceId);

            performanceDetailsRequest = cacheProvider.GetAndSave(
                () => GetCacheKey(languageCode, performanceId),
                () =>
            {
                var performance = performanceDetailsRepository
                                  .GetInformationAboutPerformance(Accountid, languageCode, performanceId)
                                  as PerformanceDetailsDataModelWp;

                var tags         = tagRepository.GetTagsByPerformanceId(performanceId).Result;
                var creativeTeam = creativeTeamRepository.GetCreativeTeam(languageCode, performanceId);

                performanceDetailsRequest = new PerformanceDetailsWpDTO()
                {
                    Title        = performance.Title,
                    Duration     = performance.Duration,
                    MinimumAge   = performance.MinimumAge,
                    MinPrice     = performance.MinPrice,
                    MaxPrice     = performance.MaxPrice,
                    Description  = performance.Description,
                    MainImage    = performance.MainImage,
                    GalleryImage = performance.GalleryImage,
                    HashTag      = from tg in tags
                                   select tg,
                    TeamMember = from tm in creativeTeam
                                 select new TeamMemberDTO()
                    {
                        FirstName = tm.FirstName,
                        LastName  = tm.LastName,
                        Role      = tm.Role,
                        RoleKey   = tm.RoleKey,
                    },
                };

                return(performanceDetailsRequest);
            });

            performanceDetailsRequest.IsChecked = isChecked;

            return(performanceDetailsRequest);
        }