Esempio n. 1
0
        /// <summary>
        /// The actual Work to be done.
        /// </summary>
        protected override void Execute()
        {
            List <CollectionModel> newlist         = new List <CollectionModel>();
            CollectionModel        collectionModel = new CollectionModel();

            List <repository> repositories = RepositoryRepository.GetRepositoriess();

            if (this.Request.CollectionId > 0)
            {
                collection collection = CollectionRepository.FirstOrDefault(c => c.Id == this.Request.CollectionId);

                collectionModel = Util.ConvertToCollectionModel(
                    collection, repositories.First(c => c.Id == collection.RepositoryId).RepositoryName);
            }
            else
            {
                foreach (collection item in CollectionRepository.GetCollections().OrderBy(c => c.CollectionName))
                {
                    newlist.Add(Util.ConvertToCollectionModel(item, repositories.First(c => c.Id == item.RepositoryId).RepositoryName));
                }
            }

            Response = new ResponseModel()
            {
                Collection         = collectionModel,
                Collections        = newlist,
                IsOperationSuccess = true
            };
        }