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; } }
public async Task <TDto> Add(TDto dto) { var response = await _domainService.Add(_mapper.Map <TEntity>(dto)); return(_mapper.Map <TDto>(response)); }
public async Task <IActionResult> Create(Domain domain) { await _domainService.Add(domain); return(Ok()); }