public bool DelDrug(string drugId, string deptid) { DrugStockOutEntity entity = dsoservice.GetEntity(drugId); var list = service.GetList(deptid).Where(x => x.DrugName == entity.DrugName && x.DrugLevel == entity.DrugLevel && x.BZId == "deptid").ToList(); foreach (DrugEntity d in list) { service.DelDrug(d); } if (entity != null) { if (dsoservice.DelDrugStcokOut(entity)) { return(true); } else { return(false); } } else { return(false); } }