public void Delete(EntityDto <int> input) { var entity = _gatewayRepository.Get(input.Id); if (entity.IsNullOrDeleted()) { throw new ApplicationException("该设备不存在或已被删除"); } _gatewayManager.Delete(entity); }
public void AffiliateDelete(Workshop entity) { var query = _gatewayManager.GetAll().Where(g => g.WorkshopId == entity.Id); ArrayList list = new ArrayList(query.Count()); if (query.Any()) { foreach (var gateway in query) { list.Add((Gateway)gateway); } } foreach (var gateway in list) { _gatewayManager.Delete((Gateway)gateway); } Delete(entity); }