示例#1
0
        public void CreateOrder(int basketId, Address address)
        {
            var basket = GetBasketById(basketId);

            orderRepo.Insert(new Order()
            {
                Address = new Address()
                {
                    City = address.City, Line = address.Line, PostCode = address.PostCode
                },
                OrderDate = DateTime.Now,
                BasketId  = basket.Id,
                Basket    = basket
            });
            basket.IsClosed = true;
            basketRepo.SaveChanges();
        }