public Order Create(CreateOrderCommand command, string email)
        {
            var user = _userRepository.GetByEmail(email);
            var orderItems = new List<OrderItem>();
            foreach (var item in command.OrderItems)
            {
                var orderItem = new OrderItem();
                var product = _productRepository.Get(item.Product);
                orderItem.AddProduct(product, item.Quantity, item.Price);
                orderItems.Add(orderItem);
            }

            var order = new Order(orderItems, user.Id);
            order.Place();
            _orderRepository.Create(order);

            if (Commit())
                return order;

            return null;
        }
 public void Update(Order order)
 {
     _context.Entry<Order>(order).State = System.Data.Entity.EntityState.Modified;
 }
 public void Create(Order order)
 {
     _context.Orders.Add(order);
 }