Exemple #1
0
        public async Task <GetUnitResponse> Handle(CreateUnitCommand request, CancellationToken cancellationToken)
        {
            var mappedUnit = _mapper.Map <CreateUnitCommand, Unit>(request);
            var created    = await _unitService.CreateAsync(mappedUnit, cancellationToken);

            return(_mapper.Map <Unit, GetUnitResponse>(created));
        }
Exemple #2
0
 public async Task <IActionResult> Create([FromBody] UnitDTO unitDto)
 {
     return(CreatedAtAction(nameof(Create), await _unitService.CreateAsync(unitDto)));
 }