Beispiel #1
0
        public ActionResult DeleteAlbum(Guid albumId)
        {
            string userEmail = Session["LoginEmail"].ToString();

            //string userEmail = "*****@*****.**";

            if (userEmail == null)
            {
                return(RedirectToAction("Index", "UserProfile"));
            }

            businessLogics = new BusinessLogics();

            if (businessLogics.IsAccountContainsThisAlbum(userEmail, albumId))
            {
                var result = businessLogics.DeleteAlbum(albumId);

                /*
                 * 0 = No Album found. Operation failed.
                 * 1 = Operation done successfully.
                 * 2 = Operation Faild while deleting album. Internal error occured.
                 * 3 = An Record Couldn't deleted from AlbumTrackMaster Table due to internal error.
                 * 4 = Operation Failed in the level of AlbumTrackMaster Label.
                 * 5 = Error while deleting a solo track that belongs to only the album
                 * 6 = Track fetching failed.
                 * 7 = Error occured while deleting a valid track
                 * 8 = A track from the album is already submitted to the store. can't delete album
                 * 9 = Error while updating the associated purchase record. User can't create an album with the valid purchase.
                 */
                if (result != 1)
                {
                    TempData["ErrorMsg"] = "Error occured while deleting album";
                }
                return(RedirectToAction("Index", "UserProfile"));
            }
            else
            {
                TempData["ErrorMsg"] = "You are trying to remove an Album that doesn't belongs to you";
                return(RedirectToAction("Index", "UserProfile"));
            }
        }