コード例 #1
0
        public void UpdateCompatibleSet(CompatibleSet compatibleSet)
        {
            var dataRec = Mapper.Map <Data.Models.CompatibleSet>(compatibleSet);

            _compatibleSetGateway.Update(dataRec);

            var oldGoods = _compatibleSetGoodsGateway.SelectByCompatibleSet(compatibleSet.CompatibleSetId);
            var newGoods = compatibleSet.CompatibleGoods;

            foreach (var oldGoodsItem in oldGoods)
            {
                if (newGoods.All(x => x.ID != oldGoodsItem.HeartId))
                {
                    _compatibleSetGoodsGateway.Delete(oldGoodsItem);
                }
            }
            foreach (var newGoodsItem in newGoods)
            {
                var compatibleSetGoodsItem = new CompatibleSetGoods()
                {
                    HeartId         = newGoodsItem.ID,
                    CompatibleSetId = compatibleSet.CompatibleSetId
                };
                if (oldGoods.All(x => x.HeartId != newGoodsItem.ID))
                {
                    _compatibleSetGoodsGateway.Insert(compatibleSetGoodsItem);
                }
            }
        }
コード例 #2
0
 public void Insert(CompatibleSetGoods rec)
 {
     Exec(GetProcedureString(), rec);
 }
コード例 #3
0
 public void Delete(CompatibleSetGoods rec)
 {
     Exec(GetProcedureString(), rec);
 }