Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Rio_Pic rio_Pic = db.Rio_Pic.Find(id);

            db.Rio_Pic.Remove(rio_Pic);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "SN,PicName,PicContent,HitCount,PicPath,CreateID,CreateDate,ModifyID,ModifyDate,IsEnable,IsDelete")] Rio_Pic rio_Pic)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rio_Pic).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rio_Pic));
 }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "SN,PicName,PicContent,HitCount,PicPath,CreateID,CreateDate,ModifyID,ModifyDate,IsEnable,IsDelete")] Rio_Pic rio_Pic)
        {
            if (ModelState.IsValid)
            {
                db.Rio_Pic.Add(rio_Pic);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rio_Pic));
        }
Esempio n. 4
0
        // GET: Rio_Pic/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Rio_Pic rio_Pic = db.Rio_Pic.Find(id);

            if (rio_Pic == null)
            {
                return(HttpNotFound());
            }
            return(View(rio_Pic));
        }
Esempio n. 5
0
        private void changeEnablePic(string[] SNArray)
        {
            foreach (var data in SNArray)
            {
                int SN = 0;
                int.TryParse(data.ToString(), out SN);


                Rio_Pic Pic = db.Rio_Pic.Find(SN);
                if (Pic.IsEnable == true)
                {
                    Pic.IsEnable = false;
                }
                else
                {
                    Pic.IsEnable = true;
                }
                PicModel.Update(Pic);
            }
        }
Esempio n. 6
0
        private void setDBimg(string ID, string fileName, string upLoadType)
        {
            Rio_Pic Pic = new Rio_Pic();

            Pic.PicName    = fileName;
            Pic.PicPath    = "/Upload/" + ID + "/" + upLoadType + "/";
            Pic.PicContent = string.Empty;
            Pic.HitCount   = 0;
            Pic.CreateID   = ID;
            Pic.CreateName = ID;
            Pic.ModifyID   = ID;
            Pic.ModifyName = ID;

            DateTime dt = DateTime.Now;

            Pic.CreateDate = dt;
            Pic.ModifyDate = dt;

            Pic.IsEnable = true;
            Pic.IsDelete = false;
            PicModel.Insert(Pic);
        }
Esempio n. 7
0
        private void deletePic(string[] SNArray)
        {
            foreach (var data in SNArray)
            {
                int SN = 0;
                int.TryParse(data.ToString(), out SN);

                //刪除實體檔案
                Rio_Pic Pic = db.Rio_Pic.Find(SN);
                if (System.IO.File.Exists(Server.MapPath(Pic.PicPath + "\\" + Pic.PicName)))
                {
                    System.IO.File.Delete(Server.MapPath(Pic.PicPath + "\\" + Pic.PicName));
                }

                //刪除實體檔案縮圖
                if (System.IO.File.Exists(Server.MapPath(Pic.PicPath + "\\Scaling\\" + Pic.PicName)))
                {
                    System.IO.File.Delete(Server.MapPath(Pic.PicPath + "\\Scaling\\" + Pic.PicName));
                }

                //資料庫更新刪除標記
                PicModel.Delete(Pic);
            }
        }