Exemple #1
0
        public async Task Update(ActionEditDto input)
        {
            var rs = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);
            if (rs == null)
            {
                throw new UserFriendlyException(string.Format("There is no actin with id : {0}", input.Id));
            }

            input.MapTo(rs);

            var result = await _repository.FirstOrDefaultAsync(x => x.ActionCode == input.ActionCode);

            if (result != null && result.Id != input.Id)
            {
                throw new UserFriendlyException(string.Format(L("DuplicateActionCode"), input.ActionCode));
            }

            await _repository.UpdateAsync(rs);
        }
Exemple #2
0
        public async Task Update(ActionEditDto input)
        {
            var rs = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

            if (rs == null)
            {
                throw new UserFriendlyException(string.Format("There is no actin with id : {0}", input.Id));
            }

            input.MapTo(rs);

            var result = await _repository.FirstOrDefaultAsync(x => x.ActionCode == input.ActionCode);

            if (result != null && result.Id != input.Id)
            {
                throw new UserFriendlyException(string.Format(L("DuplicateActionCode"), input.ActionCode));
            }

            await _repository.UpdateAsync(rs);
        }