예제 #1
0
        public async Task <ActionResult> Update(int id, [FromBody] UpdateIngredientDTO dto)
        {
            var command = _mapper.Map <UpdateIngredientCommand>(dto);

            command.Id = id;

            await _mediator.Send(command);

            return(NoContent());
        }
        public async Task <ActionResult> Update(int id, [FromBody] UpdateIngredientDTO dto)
        {
            using var uow = _unitOfWorkFactory.Create();

            await _ingredientService.UpdateIngredientAsync(
                id,
                dto.Name,
                dto.Description,
                dto.UnitPrice,
                dto.AvailableQuantity,
                dto.IsSpicy,
                dto.IsVegetarian,
                dto.IsVegan);

            uow.Commit();

            return(NoContent());
        }