public bool AddProduct(int productId, int numberOfProduct)
        {
            if (_order != null)
            {
                bool isContains = IsContainsProduct(productId);
                var  newProduct = _model.GetProduct(productId, numberOfProduct);
                if (isContains)
                {
                    var oldProduct = GetProductFromOrder(productId);
                    oldProduct.Lot.QuantityProduct += newProduct.Lot.QuantityProduct;
                }
                else
                {
                    _order.AddProduct(newProduct);
                }

                _order.TotalCost += (newProduct.Lot.QuantityProduct * newProduct.Price);
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
 public ProductFromLot GetProductFromLot(int productId, int numberOfProd)
 {
     return(_storehouseService.GetProduct(productId, numberOfProd));
 }