コード例 #1
0
 public ActionResult DeleteAll(int parentID)
 {
     using (JohnTestEntities tempdb = new JohnTestEntities())
     {
         List<RDRModuleTemp> list = tempdb.RDRModuleTemps.Where(m => m.ParentID == parentID).ToList();
         foreach (var item in list)
         {
             //db.RDRModuleTemps.Remove(item);  //幹! 這個作法竟然不能用
             db.Entry(item).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
         }
         return RedirectToAction("Details", "RDRManage", new { id = parentID });
     }
 }
コード例 #2
0
 /// <summary>
 /// 依LOB索引值取得對應的客戶群
 /// </summary>
 /// <param name="LobID">EnumLOB索引值</param>
 /// <returns></returns>
 private IEnumerable<CustomerTeam> GetTeams(string LobID)
 {
     using (JohnTestEntities db = new JohnTestEntities())
     {
         // 到時VSA、MCM 所對應的客戶群資料若有了, 再到這邊作變更
         var query = db.CustomerTeams.Where(m=>m.LobID == LobID).OrderBy(m => m.ID);
         return query.ToList();
     }
 }