Пример #1
0
        public static webModel.DynamicContentFolder ToWebModel(this coreModel.DynamicContentFolder folder)
        {
            var retVal = new webModel.DynamicContentFolder();

            retVal.InjectFrom(folder);
            return(retVal);
        }
Пример #2
0
        public static dataModel.DynamicContentFolder ToDataModel(this coreModel.DynamicContentFolder contentFolder)
        {
            if (contentFolder == null)
            {
                throw new ArgumentNullException("contentFolder");
            }

            var retVal = new dataModel.DynamicContentFolder();

            retVal.InjectFrom(contentFolder);
            return(retVal);
        }
 public coreModel.DynamicContentFolder GetFolderById(string id)
 {
     coreModel.DynamicContentFolder retVal = null;
     using (var repository = _repositoryFactory())
     {
         var entity = repository.GetContentFolderById(id);
         if (entity != null)
         {
             retVal = entity.ToCoreModel();
         }
     }
     return(retVal);
 }
        public coreModel.DynamicContentFolder CreateFolder(coreModel.DynamicContentFolder folder)
        {
            var entity = folder.ToDataModel();

            coreModel.DynamicContentFolder retVal = null;
            using (var repository = _repositoryFactory())
            {
                repository.Add(entity);
                CommitChanges(repository);
            }
            retVal = GetFolderById(entity.Id);
            return(retVal);
        }
		/// <summary>
		/// Converting to model type
		/// </summary>
		/// <param name="catalogBase"></param>
		/// <returns></returns>
		public static coreModel.DynamicContentFolder ToCoreModel(this dataModel.DynamicContentFolder dbEntity)
		{
			if (dbEntity == null)
				throw new ArgumentNullException("dbEntity");

			var retVal = new coreModel.DynamicContentFolder();
			retVal.InjectFrom(dbEntity);
			if (dbEntity.ParentFolder != null)
			{
				retVal.ParentFolder = dbEntity.ParentFolder.ToCoreModel();
			}
			return retVal;
		}
Пример #6
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="catalogBase"></param>
        /// <returns></returns>
        public static coreModel.DynamicContentFolder ToCoreModel(this dataModel.DynamicContentFolder dbEntity)
        {
            if (dbEntity == null)
            {
                throw new ArgumentNullException("dbEntity");
            }

            var retVal = new coreModel.DynamicContentFolder();

            retVal.InjectFrom(dbEntity);
            if (dbEntity.ParentFolder != null)
            {
                retVal.ParentFolder = dbEntity.ParentFolder.ToCoreModel();
            }
            return(retVal);
        }
 public void UpdateFolder(coreModel.DynamicContentFolder folder)
 {
     using (var repository = _repositoryFactory())
         using (var changeTracker = GetChangeTracker(repository))
         {
             var sourceEntity = folder.ToDataModel();
             var targetEntity = repository.GetContentFolderById(folder.Id);
             if (targetEntity == null)
             {
                 repository.Add(sourceEntity);
             }
             else
             {
                 changeTracker.Attach(targetEntity);
                 sourceEntity.Patch(targetEntity);
             }
             CommitChanges(repository);
         }
 }
		public static coreModel.DynamicContentFolder ToCoreModel(this webModel.DynamicContentFolder folder)
		{
			var retVal = new coreModel.DynamicContentFolder();
			retVal.InjectFrom(folder);
			return retVal;
		}