Пример #1
0
        /// <summary>
        /// Saves the order without items, to the DB
        /// </summary>
        public void SaveOrder(Order order)
        {
            if (order != null)
            {
                //create an order number
                //obviously, this is arbitrary
                //create what you will, here
                order.OrderNumber = "MVC-" + order.ID.ToString().Substring(0, 6);

                //if the shipping method is null
                //default it to the first item
                order.ShippingMethod = order.ShippingMethod ?? _shippingRepository.GetShippingMethods().Take(1).SingleOrDefault();

                //save it
                _orderRepository.SaveOrder(order);
            }
        }