Пример #1
0
        public ActionResult GetPhotoPoints()
        {
            Validation vld     = new Validation();
            int        photoID = vld.GetInt("id", false, "请传入照片编号");

            PhotoBLL photoBLL = new PhotoBLL();
            var      res      = photoBLL.GetPhotoPoints(photoID);

            return(Json(new { success = true, data = res }));
        }
Пример #2
0
        public ActionResult DeletePhoto()
        {
            if (!AppData.IsManagerLogin)
            {
                return(Json(new { success = false, msg = "您未登录后台或会话已过期" }));
            }
            if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1003))
            {
                return(Json(new { success = false, msg = "您没有执行该操作的权限" }));
            }

            Validation vld      = new Validation();
            int        photoID  = vld.GetInt("id", false, "请传入照片编号");
            PhotoBLL   photoBLL = new PhotoBLL();
            PhotoObj   photoObj = photoBLL.GetPhotoByID(photoID);

            System.IO.File.Delete(Config.MediaPath + photoObj.Pic.Replace("/", "\\"));

            JsonArray points = photoBLL.GetPhotoPoints(photoID);

            if (points != null)
            {
                string pic;
                for (int i = 0; i < points.Count; i++)
                {
                    if (points[i]["Pic"] != null)
                    {
                        pic = (string)points[i]["Pic"];
                        System.IO.File.Delete(Config.MediaPath + pic.Replace("/", "\\"));
                    }
                }
            }

            photoBLL.DeletePhoto(photoID);

            return(Json(new { success = true }));
        }