Example #1
0
        /// <summary>
        /// Persist this template object to the data store.
        /// </summary>
        public void Save()
        {
            using (var repo = new MediaTemplateRepository())
            {
                repo.Save(this);
            }

            HelperFunctions.PurgeCache();
        }
Example #2
0
        /// <summary>
        /// Persist this template object to the data store.
        /// </summary>
        public void Save()
        {
            using (var repo = new MediaTemplateRepository())
            {
                repo.Save(this);
            }

            CacheController.RemoveMediaTemplatesFromCache();
        }
Example #3
0
        /// <summary>
        /// Permanently delete the current template from the data store. This action cannot be undone.
        /// </summary>
        public void Delete()
        {
            using (var repo = new MediaTemplateRepository())
            {
                var tmplDto = repo.Find(MediaTemplateId);

                if (tmplDto != null)
                {
                    repo.Delete(tmplDto);
                    repo.Save();
                }
            }

            HelperFunctions.PurgeCache();
        }
Example #4
0
        /// <summary>
        /// Permanently delete the current template from the data store. This action cannot be undone.
        /// </summary>
        public void Delete()
        {
            using (var repo = new MediaTemplateRepository())
            {
                var tmplDto = repo.Find(MediaTemplateId);

                if (tmplDto != null)
                {
                    repo.Delete(tmplDto);
                    repo.Save();
                }
            }

            CacheController.RemoveMediaTemplatesFromCache();
        }
Example #5
0
        /// <summary>
        /// Persist this template object to the data store.
        /// </summary>
        public void Save()
        {
            using (var repo = new MediaTemplateRepository())
            {
                repo.Save(this);
            }

            HelperFunctions.PurgeCache();
        }
Example #6
0
        /// <summary>
        /// Permanently delete the current template from the data store. This action cannot be undone.
        /// </summary>
        public void Delete()
        {
            using (var repo = new MediaTemplateRepository())
            {
                var tmplDto = repo.Find(MediaTemplateId);

                if (tmplDto != null)
                {
                    repo.Delete(tmplDto);
                    repo.Save();
                }
            }

            HelperFunctions.PurgeCache();
        }
Example #7
0
		/// <summary>
		/// Gets a collection of the media templates from the data store. The items may be returned from a cache.
		/// Returns an empty collection if no items exist.
		/// </summary>
		/// <returns>Returns a <see cref="IMediaTemplateCollection" /> representing the media templates in the current application.</returns>
		public static IMediaTemplateCollection LoadMediaTemplates()
		{
			var tmpl = (IMediaTemplateCollection)HelperFunctions.GetCache(CacheItem.MediaTemplates);

			if (tmpl != null)
			{
				return tmpl;
			}

			// Nothing in the cache, so get from data store and add to cache.
			using (var repo = new MediaTemplateRepository())
			{
				tmpl = repo.GetMediaTemplates(new MediaTemplateCollection());
			}

			HelperFunctions.SetCache(CacheItem.MediaTemplates, tmpl);

			return tmpl;
		}