예제 #1
0
 public IOrder CreateOrder( IShoppingCart cart )
 {
     var result = new Order {
     Id = Guid.NewGuid()
       };
       using( var context = new Context() ) {
     result.ShoppingCart = context.ShoppingCarts.Single( n => n.Id == cart.Id );
     context.Orders.Add( result );
     context.SaveChanges();
       }
       return result;
 }
예제 #2
0
 public IShoppingCart CreateCart( IContact contact )
 {
     var result = new ShoppingCart() {
     Id = Guid.NewGuid(),
     Contact = contact as Contact
       };
       using( var context = new Context() ) {
     context.ShoppingCarts.Add( result );
     context.SaveChanges();
       }
       return result;
 }
예제 #3
0
 public IShoppingCartItem AddItemToCart(ProductOffer productOffer, IShoppingCart cart )
 {
     var result = new ShoppingCartItem {
     Id = Guid.NewGuid(),
     Created = System.DateTime.Now
       };
       using( var context = new Context() ) {
     result.ShoppingCart = context.ShoppingCarts.Single( n => n.Id == cart.Id );
     result.ProductOffer = context.ProductOffers.Single( n => n.Id == productOffer.Id );
     context.ShoppingCartItems.Add( result );
     context.SaveChanges();
       }
       return result;
 }
예제 #4
0
 public void Product_InsertTest()
 {
     //Arrange
       var product = new Product();
       product.Id = Guid.NewGuid();
       product.Name = "Crabs";
       using( Context context = new Context() ) {
     context.Products.Add( product );
        // var productParames = new AddNewProductParameters { Name = "Horses" };
     //var result = context.CallStoredProc<AddNewProductParameters>( context.AddNewProduct, productParames );
     context.SaveChanges();
       }
       //Act
       //Assert
 }