コード例 #1
0
 public bool AddProductSize(int pid, SizeModel model)
 {
     using (ShoppingELFEntities context = new ShoppingELFEntities())
     {
         SizeTable st = new SizeTable()
         {
             ProductID       = pid,
             productSize     = model.productSize,
             productPrice    = model.productPrice,
             productQuantity = model.productQuantity
         };
         context.SizeTable.Add(st);
         context.SaveChanges();
         SelectMininmumPrice(pid);
     }
     return(true);
 }
コード例 #2
0
 public bool EditProduct(int pid, SizeModel model)
 {
     using (ShoppingELFEntities context = new ShoppingELFEntities())
     {
         var product = context.SizeTable.FirstOrDefault(x => x.PID == pid);
         if (product != null)
         {
             product.productPrice    = model.productPrice;
             product.productQuantity = model.productQuantity;
             product.productSize     = model.productSize;
             context.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }