示例#1
0
        public void ResetImage(int userImageID,  string bootPath)
        {
            UserImagesDeleted modelD = Get(userImageID);
            bizUserImages b = new bizUserImages();
            UserImages model = b.Get(userImageID);

            model.Attach();
            model.ImageSmallPath = modelD.ImageSmallPath;
            model.ImagePath = modelD.ImagePath;
            model.ImageSize = modelD.ImageSize;
            model.Width = modelD.Width;
            model.Height = modelD.Height;
            model.Detach();
            b.Update(model);

            string extName = MyText.GetFileExtName(model.ImageSmallPath);

            System.IO.File.Copy(bootPath + "/userfiles/deleted/" + model.UserImageID + "small." + extName,bootPath + model.ImageSmallPath, true);
            System.IO.File.Copy(bootPath + "/userfiles/deleted/" + model.UserImageID + "." + extName, bootPath + model.ImagePath, true);

            System.IO.File.Delete(bootPath + "/userfiles/deleted/" + model.UserImageID + "small." + extName);
            System.IO.File.Delete(bootPath + "/userfiles/deleted/" + model.UserImageID + "." + extName);

            Delete(userImageID);
        }
示例#2
0
 public ContentResult ImagesDelete(int id)
 {
     bizUserImages bi = new bizUserImages();
     UserImages model = bi.Get(id);
     if (model == null || model.UserID != UserID)
         return Content("����Ȩɾ����ͼƬ");
     try
     {
         //return Content(Images.GetPhysicsPath(model.ImagePath, ConfigurationManager.AppSettings["ImagePath"]));
         System.IO.File.Delete(Images.GetPhysicsPath(model.ImagePath, ConfigurationManager.AppSettings["ImagePath"]));
         System.IO.File.Delete(Images.GetPhysicsPath(model.ImageSmallPath, ConfigurationManager.AppSettings["ImagePath"]));
         bi.Delete(model.UserImageID);
         return Content("");
     }
     catch { return Content("ɾ��ʧ��"); }
 }
示例#3
0
 public ActionResult UserImagesDelete(int id)
 {
     bizUserImages bui = new bizUserImages();
     bizUserImagesDeleted buid = new bizUserImagesDeleted();
     UserImages model = bui.Get(id);
     buid.Remove(model, UserName, ConfigurationManager.AppSettings["ImagePath"]);
     return RedirectToAction("UserImages");
 }