コード例 #1
0
ファイル: Cart.cs プロジェクト: Melargus/RemainsTest
 public void AddItem(Product p, ProductChars pchar, string shk, double q, string cutting, double price)
 {
     this._cartLines.Add(new CartLine()
     {
         Product     = p,
         ProductChar = pchar,
         Shk         = shk,
         Quantity    = q,
         Price       = price,
         Cutting     = cutting,
         Id          = Guid.NewGuid()
     });
 }
コード例 #2
0
ファイル: Cart.cs プロジェクト: Melargus/RemainsTest
        public void AddItem(ProductChars pchar, double q, string cutting)
        {
            Product product;

            using (DataContext dataContext = new DataContext())
                product = dataContext.Products.Where <Product>((Expression <Func <Product, bool> >)(pr => pr.Id == pchar.ProductId)).FirstOrDefault <Product>();
            this._cartLines.Add(new CartLine()
            {
                Product     = product,
                ProductChar = pchar,
                Quantity    = q,
                Cutting     = cutting
            });
        }