Пример #1
0
        public List <ListUserCreated> GetUserCreatedLists(string userName)
        {
            var listsModel = new List <ListUserCreated>();

            var cacheItems = ApplicationCache <ListDescriptionTO> .GetCacheItems(d => d.User.UserName == userName);

            if (cacheItems.Count > 0)
            {
                Mapper.CreateMap <ListDescriptionTO, ListUserCreated>();
                listsModel = Mapper.Map <List <ListDescriptionTO>, List <ListUserCreated> >(cacheItems);
            }
            else
            {
                var lists = _authRepository.GetUserCreatedLists(userName);

                if (lists != null)
                {
                    Mapper.CreateMap <List, ListUserCreated>();
                    listsModel = Mapper.Map <List <List>, List <ListUserCreated> >(lists);
                }
            }

            return(listsModel);
        }