Beispiel #1
0
        public ViewResult AddProduct(string id)
        {
            Product product = productModel.SelectById(id);

            order.AddProduct(product, 1);
            return(View("Basket", order.LineItems));
        }
        public IOrder CreateOrder(List <string> productsIds, decimal unitPrice, string salesmanId)
        {
            IOrder order = _salesFactory.CreateOrder(unitPrice);

            foreach (var id in productsIds)
            {
                order.AddProduct(id);
            }

            ISalesman salesman = _salesmanRepository.GetById(salesmanId);

            salesman.AddToYearQuota(order.GetTotalPrice());

            _orderRepository.Add(order);
            return(order);
        }