Пример #1
0
        public async Task <ActionResult> Create([FromBody] CreatePizzaDTO dto)
        {
            using var uow = _unitOfWorkFactory.Create();

            var result = await _pizzaService.CreatePizzaAsync(
                dto.Name,
                dto.Description,
                dto.UnitPrice,
                dto.IngredientIds);

            var resultDto = _mapper.Map <PizzaDTO>(result);

            uow.Commit();

            return(CreatedAtAction(nameof(Get), new { resultDto.Id }, resultDto));
        }