예제 #1
0
        public static coreModel.DynamicContentPlace ToCoreModel(this webModel.DynamicContentPlace place)
        {
            var retVal = new coreModel.DynamicContentPlace();

            retVal.InjectFrom(place);
            return(retVal);
        }
예제 #2
0
        public static webModel.DynamicContentPlace ToWebModel(this coreModel.DynamicContentPlace place)
        {
            var retVal = new webModel.DynamicContentPlace();

            retVal.InjectFrom(place);
            if (place.Folder != null)
            {
                retVal.Outline = place.Folder.Outline;
                retVal.Path    = place.Folder.Path;
            }
            return(retVal);
        }
 public coreModel.DynamicContentPlace GetPlaceById(string id)
 {
     coreModel.DynamicContentPlace retVal = null;
     using (var repository = _repositoryFactory())
     {
         var entity = repository.GetContentPlaceById(id);
         if (entity != null)
         {
             retVal = entity.ToCoreModel();
         }
     }
     return(retVal);
 }
        public coreModel.DynamicContentPlace CreatePlace(coreModel.DynamicContentPlace place)
        {
            var entity = place.ToDataModel();

            coreModel.DynamicContentPlace retVal = null;
            using (var repository = _repositoryFactory())
            {
                repository.Add(entity);
                CommitChanges(repository);
            }
            retVal = GetPlaceById(entity.Id);
            return(retVal);
        }
예제 #5
0
        public static dataModel.DynamicContentPlace ToDataModel(this coreModel.DynamicContentPlace contentPlace)
        {
            if (contentPlace == null)
            {
                throw new ArgumentNullException("contentPlace");
            }

            var retVal = new dataModel.DynamicContentPlace();

            retVal.InjectFrom(contentPlace);

            return(retVal);
        }
		/// <summary>
		/// Converting to model type
		/// </summary>
		/// <param name="catalogBase"></param>
		/// <returns></returns>
		public static coreModel.DynamicContentPlace ToCoreModel(this dataModel.DynamicContentPlace dbEntity)
		{
			if (dbEntity == null)
				throw new ArgumentNullException("dbEntity");

			var retVal = new coreModel.DynamicContentPlace();
			retVal.InjectFrom(dbEntity);

			if(dbEntity.Folder != null)
			{
				retVal.Folder = dbEntity.Folder.ToCoreModel();
			}

			return retVal;
		}
예제 #7
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="catalogBase"></param>
        /// <returns></returns>
        public static coreModel.DynamicContentPlace ToCoreModel(this dataModel.DynamicContentPlace dbEntity)
        {
            if (dbEntity == null)
            {
                throw new ArgumentNullException("dbEntity");
            }

            var retVal = new coreModel.DynamicContentPlace();

            retVal.InjectFrom(dbEntity);

            if (dbEntity.Folder != null)
            {
                retVal.Folder = dbEntity.Folder.ToCoreModel();
            }

            return(retVal);
        }
 public void UpdatePlace(coreModel.DynamicContentPlace place)
 {
     using (var repository = _repositoryFactory())
         using (var changeTracker = GetChangeTracker(repository))
         {
             var sourceEntity = place.ToDataModel();
             var targetEntity = repository.GetContentPlaceById(place.Id);
             if (targetEntity == null)
             {
                 repository.Add(sourceEntity);
             }
             else
             {
                 changeTracker.Attach(targetEntity);
                 sourceEntity.Patch(targetEntity);
             }
             CommitChanges(repository);
         }
 }
		public static coreModel.DynamicContentPlace ToCoreModel(this webModel.DynamicContentPlace place)
		{
			var retVal = new coreModel.DynamicContentPlace();
			retVal.InjectFrom(place);
			return retVal;
		}