public ActionResult DeleteConfirmed(int id)
        {
            //客戶資料 客戶資料 = db.客戶資料.Find(id);
            //客戶資料.是否已刪除 = true;
            ////db.客戶資料.Remove(客戶資料);
            //db.SaveChanges();

            客戶聯絡人Repository repoC = new 客戶聯絡人Repository();
            repoC.DeleteRange(repoC.All().Where(c => c.客戶Id == id));
            repoC.UnitOfWork.Commit();

            客戶銀行資訊Repository repoB = new 客戶銀行資訊Repository();
            repoB.DeleteRange(repoB.All().Where(c => c.客戶Id == id));
            repoB.UnitOfWork.Commit();

            repo.Delete(repo.Find(id));
            repo.UnitOfWork.Commit();
            return RedirectToAction("Index");
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            //客戶資料 客戶資料 = db.客戶資料.Find(id);
            //客戶資料.是否已刪除 = true;
            ////db.客戶資料.Remove(客戶資料);
            //db.SaveChanges();

            客戶聯絡人Repository repoC = new 客戶聯絡人Repository();

            repoC.DeleteRange(repoC.All().Where(c => c.客戶Id == id));
            repoC.UnitOfWork.Commit();

            客戶銀行資訊Repository repoB = new 客戶銀行資訊Repository();

            repoB.DeleteRange(repoB.All().Where(c => c.客戶Id == id));
            repoB.UnitOfWork.Commit();

            repo.Delete(repo.Find(id));
            repo.UnitOfWork.Commit();
            return(RedirectToAction("Index"));
        }