예제 #1
0
        public async Task <IActionResult> ChangeWeightAsync(Guid id, [FromBody] Dto dto)
        {
            try
            {
                var weight = dto.Validate();

                await _useCase.ChangeWeightAsync(new ProductId(id), weight.Value);

                return(Ok());
            }
            catch (NotFoundException <ProductId> )
            {
                return(NotFound());
            }
            catch (ValidationException)
            {
                return(BadRequest());
            }
        }