public override int Delete(int id) { //1.对attrKey的删除 dal.Delete(id); //2.对attrValue的删除 IProductAttrValueDAL attrValueDal = new ProductAttrValueDAL(); var attrValueList = attrValueDal.GetAllByAttrKeyID(id); if (attrValueList.Count > 0) //下拉选择时选择属性值 { foreach (var item in attrValueList) { attrValueDal.Delete(item); } } return(SaveChange()); }
public int Update(ProductAttrKey attrKey, List <ProductAttrValue> attrValues) { dal.Update(attrKey); IProductAttrValueDAL attrValueDal = new ProductAttrValueDAL(); var attrValueList = attrValueDal.GetAllByAttrKeyID(attrKey.ID); foreach (var item in attrValueList) { attrValueDal.Delete(item); } foreach (var item in attrValues) { attrValueDal.Add(item); } return(SaveChange()); }