public bool Delete(string billNo) { var checkbm = CheckBillMasterRepository.GetQueryable().FirstOrDefault(i => i.BillNo == billNo && i.Status == "1"); if (checkbm != null) { foreach (var item in checkbm.CheckBillDetails.ToArray()) { item.Storage.IsLock = "0"; } using (var scope = new TransactionScope()) { CheckBillMasterRepository.SaveChanges(); CheckBillDetailRepository.GetObjectSet().DeleteEntity(d => d.BillNo == billNo); CheckBillMasterRepository.GetObjectSet().DeleteEntity(c => c.BillNo == billNo); scope.Complete(); } } return(true); }