Ejemplo n.º 1
0
        public async Task <IActionResult> CodeItemCombEntryAdd(codeItemCombEntry cice)
        {
            try
            {
                //判断关系是否存在
                var codeItemCombEntryn = _codeItemCombEntryRepository.FindByClause(o => o.combCode == cice.combCode);
                //如果不存在关系则添加,存在则修改
                if (codeItemCombEntryn == null)
                {
                    codeItemCombEntry cicen = new codeItemCombEntry();
                    cicen.combCode = cice.combCode;
                    cicen.clsCode  = cice.clsCode;
                    cicen.itemCode = cice.itemCode;
                    await Task.Factory.StartNew(() => _codeItemCombEntryRepository.Insert(cicen));

                    result.returnMsg = "成功添加关系";
                }
                else
                {
                    codeItemCombEntryn.combCode = cice.combCode;
                    codeItemCombEntryn.clsCode  = cice.clsCode;
                    codeItemCombEntryn.itemCode = cice.itemCode;
                    await Task.Factory.StartNew(() => _codeItemCombEntryRepository.Update(codeItemCombEntryn));

                    result.returnMsg = "成功修改关系";
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                result.success   = false;
                result.returnMsg = "添加关系失败";
            }
            return(Ok(result));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加项目-组合关系
 /// </summary>
 /// <param name="cice"></param>
 /// <returns></returns>
 public bool CodeItemCombEntryAdd(codeItemCombEntry cice)
 {
     try
     {
         _codeItemCombEntryRepository.Insert(cice);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }