示例#1
0
        public FAGText Map(EditFAGTextRequest request)
        {
            if (request == null)
            {
                return(null);
            }

            FAGText fagText = new FAGText
            {
                Id      = request.Id,
                Text    = request.Text,
                TextRTF = request.TextRTF,
                Iso3cc  = request.Iso3cc,
                Iso2cc  = request.Iso2cc,
            };

            return(fagText);
        }
示例#2
0
        public async Task <FAGTextResponse> EditFAGTextAsync(EditFAGTextRequest request)
        {
            FAGText existingRecord = await _fagTextRespository.GetAsync(request.Id);

            if (existingRecord == null)
            {
                throw new ArgumentException($"Entity with {request.Id} is not present");
            }

            FAGText entity = _fagTextMapper.Map(request);
            FAGText result = _fagTextRespository.Update(entity);

            int modifiedRecords = await _fagTextRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Logging.Events.Edit, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Logging.Events.Edit, Messages.ChangesApplied_id, result?.Id);

            return(_fagTextMapper.Map(result));
        }