Ejemplo n.º 1
0
 public void ActionDeletealone(int?id)
 {
     if (id != null)
     {
         擺腹BuyFoodContext db = new 擺腹BuyFoodContext();
         var table           = db.TActivities.FirstOrDefault(n => n.CActivityId == id);
         if (table != null)
         {
             db.Remove(table);
         }
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void ActionDelete([FromBody] List <yupushstrViewModel> Array)
 {
     if (Array != null)
     {
         擺腹BuyFoodContext db = new 擺腹BuyFoodContext();
         for (int i = 0; i < Array.Count; i++)
         {
             TActivity table = db.TActivities.FirstOrDefault(a => a.CActivityId.ToString() == Array[i].strmember);
             if (table != null)
             {
                 if (table.CPicture != null)
                 {
                     FileInfo file = new FileInfo(table.CPicture);
                     if (file.Exists)
                     {
                         file.Delete();
                     }
                 }
                 db.Remove(table);
                 db.SaveChanges();
             }
         }
     }
 }