Esempio n. 1
0
        public Guid CreateOrder(OrderRequest request)
        {
            var pc     = _pcRepo.Get(request.PcId);
            var client = _clientRepo.Get(request.ClientId);

            var order = _orderFactory.CreateOrder(client, pc, request.Quantity, request.DestinationCountry);

            order.GetDiscount();
            _taxService.CalculateTaxes(order);

            if (!_orderValidationService.ValidateOrder(order))
            {
                throw new ArgumentException();
            }

            _deliveryService.EstimateDelivery(order);
            _clientRepo.SubtractMoney(client.Id, order.Price);
            _notifier.Notify(client, "An order has been made");

            return(_ordersRepo.Save(order).Id);
        }
Esempio n. 2
0
 public IEnumerable <PcDto> GetPcs()
 {
     return(_pcRepo.Get().ToDtos());
 }