Beispiel #1
0
        public async Task <ConsumableDto> CreateAsync(ConsumableForCreationDto consumableForCreation)
        {
            var consumable = _mapper.Map <Consumable>(consumableForCreation);

            consumable = await _userService.BindAssetWithUserAsync(CurrentUserId, consumable);

            _repositoryManager.Consumable.CreateConsumable(consumable);
            await _repositoryManager.SaveAsync();

            return(_mapper.Map <ConsumableDto>(consumable));
        }
        public async Task <IActionResult> PostConsumable(ConsumableForCreationDto consumableForCreation)
        {
            var consumable = await _consumableService.CreateAsync(consumableForCreation);

            return(CreatedAtAction("GetConsumable", new { id = consumable.Id }, consumable));
        }