Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Albums album = albumHandler.GetById(id);

            albumHandler.Delete(album);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Permanently delete this album from the data store and disk. Validation is performed prior to deletion to ensure
        /// album can be safely deleted. The validation is contained in the method <see cref="ValidateBeforeAlbumDelete"/>
        /// and may be invoked separately if desired. No security checks are performed; the caller must ensure the user
        /// has permission to delete an album prior to invoking this method.
        /// </summary>
        /// <param name="album">The album to delete. If null, the function returns without taking any action.</param>
        /// <exception cref="ErrorHandler.CustomExceptions.CannotDeleteAlbumException">Thrown when the album does not meet the
        /// requirements for safe deletion. At this time this exception is thrown only when the album is or contains the user album
        /// parent album and user albums are enabled.</exception>
        public static void DeleteAlbum(IAlbum album)
        {
            if (album == null)
            {
                return;
            }

            ValidateBeforeAlbumDelete(album);

            OnBeforeAlbumDelete(album);

            album.Delete();

            HelperFunctions.PurgeCache();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Permanently delete this album from the data store and optionally the hard drive. Validation is performed prior to deletion to ensure
        /// album can be safely deleted. The validation is contained in the method <see cref="ValidateBeforeAlbumDelete"/>
        /// and may be invoked separately if desired. No security checks are performed; the caller must ensure the user
        /// has permission to delete an album prior to invoking this method.
        /// </summary>
        /// <param name="album">The album to delete. If null, the function returns without taking any action.</param>
        /// <param name="deleteFromFileSystem">if set to <c>true</c> the files and directories associated with the album
        /// are deleted from the hard disk. Set this to <c>false</c> to delete only the database records.</param>
        /// <exception cref="ErrorHandler.CustomExceptions.CannotDeleteAlbumException">Thrown when the album does not meet the
        /// requirements for safe deletion. At this time this exception is thrown only when the album is or contains the user album
        /// parent album and user albums are enabled.</exception>
        public static void DeleteAlbum(IAlbum album, bool deleteFromFileSystem)
        {
            if (album == null)
            {
                return;
            }

            ValidateBeforeAlbumDelete(album);

            OnBeforeAlbumDelete(album);

            if (deleteFromFileSystem)
            {
                album.Delete();
            }
            else
            {
                album.DeleteFromGallery();
            }

            HelperFunctions.PurgeCache();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Permanently delete this album from the data store and optionally the hard drive. Validation is performed prior to deletion to ensure
        /// current user has delete permission and the album can be safely deleted. The validation is contained in the method 
        /// <see cref="ValidateBeforeAlbumDelete"/> and may be invoked separately if desired.
        /// </summary>
        /// <param name="album">The album to delete. If null, the function returns without taking any action.</param>
        /// <param name="deleteFromFileSystem">if set to <c>true</c> the files and directories associated with the album
        /// are deleted from the hard disk. Set this to <c>false</c> to delete only the database records.</param>
        /// <exception cref="CannotDeleteAlbumException">Thrown when the album does not meet the requirements for safe deletion.
        /// This includes detecting when the media objects path is read only and when the album is or contains the user album
        /// parent album and user albums are enabled.</exception>
        /// <exception cref="GallerySecurityException">Thrown when the current user does not have permission to delete the album.</exception>
        public static void DeleteAlbum(IAlbum album, bool deleteFromFileSystem = true)
        {
            if (album == null)
                return;

            ValidateBeforeAlbumDelete(album);

            OnBeforeAlbumDelete(album);

            if (deleteFromFileSystem)
            {
                album.Delete();
            }
            else
            {
                album.DeleteFromGallery();
            }

            HelperFunctions.PurgeCache();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Delete multipule Albums
        /// </summary>
        /// <param name="albums"></param>
        public static void Delete(List <Album> albums)
        {
            IAlbum userResource = Resource.GetResource <IAlbum>();

            userResource.Delete(albums);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Delete a single Album
        /// </summary>
        /// <param name="album"></param>
        public static void Delete(Album album)
        {
            IAlbum userResource = Resource.GetResource <IAlbum>();

            userResource.Delete(album);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 物理删除数据 Delete(Guid Guid)
 /// </summary>
 /// <param name="guid">主键Id(int)</param>
 /// <returns>true:删除成功; false:删除失败</returns>
 public bool Delete(string guid)
 {
     return(_album.Delete(guid));
 }
Ejemplo n.º 8
0
		/// <summary>
		/// Permanently delete this album from the data store and disk. Validation is performed prior to deletion to ensure
		/// album can be safely deleted. The validation is contained in the method <see cref="ValidateBeforeAlbumDelete"/>
		/// and may be invoked separately if desired. No security checks are performed; the caller must ensure the user
		/// has permission to delete an album prior to invoking this method.
		/// </summary>
		/// <param name="album">The album to delete. If null, the function returns without taking any action.</param>
		/// <exception cref="ErrorHandler.CustomExceptions.CannotDeleteAlbumException">Thrown when the album does not meet the 
		/// requirements for safe deletion. At this time this exception is thrown only when the album is or contains the user album 
		/// parent album and user albums are enabled.</exception>
		public static void DeleteAlbum(IAlbum album)
		{
			if (album == null)
				return;

			ValidateBeforeAlbumDelete(album);

			OnBeforeAlbumDelete(album);

			album.Delete();

			HelperFunctions.PurgeCache();
		}