예제 #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());
        }