public void ProcessRequest(HttpContext context)
        {
            var user = CurrentUser;
            var assetId = context.Request.QueryString["Id"];
            var assetManager = new LocalDiskAssetManager(context);
            var asset = LoadAsset(long.Parse(assetId));
            if (!asset.UserHasAccessToAsset(user))
                throw new UnauthorizedAccessException();

            var stream = assetManager.GetAssetData(asset);
            context.Response.Clear();
            context.Response.ContentType = "image/jpg";
            context.Response.BinaryWrite(ReadFully(stream));
            stream.CopyTo(context.Response.OutputStream);
            context.Response.Flush();
            context.Response.End();
        }
 public void FileUpload_Click(object sender, EventArgs e)
 {
     if (fileUpload.HasFile)
     {
         var asset = CreateAsset(album, fileUpload.FileName);
         try
         {
             var manager = new LocalDiskAssetManager(HttpContext.Current);
             var fileBytes = fileUpload.FileBytes;
             var dataStream = new MemoryStream(fileBytes);
             manager.SaveAsset(asset, dataStream);
         }
         catch (Exception ex)
         {
             DeleteAsset(asset);
         }
         Response.Redirect("EditAsset.aspx?Id=" + asset.ID);
     }
 }
        public string DeleteEntity(string EntityType, string EnityID)
        {
            AssetManager = new LocalDiskAssetManager(HttpContext.Current);
            var id = long.Parse(EnityID);

            if (EntityType == "User")
                DeleteUser(id);

            if (EntityType == "Asset")
                DeleteAsset(id);

            if (EntityType == "Album")
                DeleteAlbum(id);

            if (EntityType == "Child")
                DeleteChild(id);

            return "sucess";
        }