コード例 #1
0
        public virtual TUiDto Add(TBareDto dto)
        {
            try
            {
                // convert to a domain entity
                TDomainEntity domainEntity = _bareDtoToDomainAdapter.Adapt(dto);

                // add to database
                Tuple <bool, TDomainEntity> addResult = _domainService.Add(domainEntity);
                return(addResult.Item1 ? _domainToUiDtoAdapter.Adapt(addResult.Item2) : null);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, Literals.p_ErrorAddingDtoOfTypeX.ParseParameter(typeof(TBareDto).Name));
                throw;
            }
        }
コード例 #2
0
        public async Task <TDto> Add(TDto dto)
        {
            var response = await _domainService.Add(_mapper.Map <TEntity>(dto));

            return(_mapper.Map <TDto>(response));
        }
コード例 #3
0
        public async Task <IActionResult> Create(Domain domain)
        {
            await _domainService.Add(domain);

            return(Ok());
        }