예제 #1
0
        public async Task <ResultEntity> AddOrUpdateAsync(RuleEditDto editDto)
        {
            var barcodeRule = Mapper.Map <Rule>(editDto);
            var result      = await _barcodeRuleManager.AddOrUpdateAsync(barcodeRule);

            if (result.Success)
            {
                await _unitOfWork.CommitAsync();

                if (editDto.Id > 0)
                {
                    await _logManager.LogInfomationAsync(EnumLogType.Audit, LogTitleConstString.BarcodeRuleEdit,
                                                         $"【{editDto.Name}】", JsonConvert.SerializeObject(barcodeRule), editDto.CreateBy);
                }
                else
                {
                    await _logManager.LogInfomationAsync(EnumLogType.Audit, LogTitleConstString.BarcodeRuleAdd,
                                                         $"【{editDto.Name}】", JsonConvert.SerializeObject(barcodeRule), editDto.CreateBy);
                }
            }
            return(result);
        }