Exemplo n.º 1
0
        protected CollectionModel LoadSingleObject(string alias)
        {
            var collection      = new Collection();
            var collectionModel = new CollectionModel();

            string collectionAliasKey = string.Format("collections-{0}", alias);

            if (!string.IsNullOrEmpty(alias))
            {
                if (_loadedModel.ContainsKey(collectionAliasKey))
                {
                    var collections = (List <CollectionModel>)_loadedModel[collectionAliasKey];
                    collectionModel = collections.Find(a => a.Alias.Equals(alias));
                    _loadedModel.Add(collectionAliasKey, collectionModel);
                }
                else
                {
                    collection = collectionService.GetByAlias(alias);
                    if (collection != null)
                    {
                        collectionModel = Mapper.Map <CollectionModel>(collection);
                        _loadedModel.Add(collectionAliasKey, collectionModel);
                    }
                }
                return(collectionModel);
            }

            return(null);
        }
Exemplo n.º 2
0
 public ProductsModel(CollectionModel collectionModel)
 {
     this.collectionModel = collectionModel;
     _loadedModel         = new Dictionary <string, object>();
 }