예제 #1
0
        // *******************************************************************************************************************************
        #region -  UpdateStatusAsync  -

        public async Task <string> UpdateStatusAsync(UpdateProductStatusCommand cmd)
        {
            var dto = await ProductDAL.GetProductAsync(cmd.ASIN).ConfigureAwait(false);

            if (dto.IsNull())
            {
                return(MsgCodes.ProductNotExists);
            }
            // ^^^^^^^^^^

            dto.Status = (ProductStatusEnum)cmd.Status;
            return(await ProductDAL.UpdateProductStatusAsync(dto).ConfigureAwait(false));
        }
        public void UpdateProductStatus(UpdateProductStatusCommand command)
        {
            var productStatus = _productRepository.GetProductStatus(command.ProductId);

            if (productStatus == null)
            {
                _productRepository.AddNewProductStatus(new ProductStatus(command.ProductId, command.TotalAfterOrderExecuted));
            }
            else
            {
                productStatus.UpdateAvailable(command.TotalAfterOrderExecuted);
                _productRepository.UpdateProductStatus(productStatus);
            }
        }
 public void Handle(UpdateProductStatusCommand command)
 {
     _productStatusService.UpdateProductStatus(command);
 }
 public Task <string> UpdateStatusAsync(UpdateProductStatusCommand cmd) => base.RequestAsync(cmd);