コード例 #1
0
        private void btnSaveO_Click(object sender, RoutedEventArgs e)
        {
            Order1 order = null;

            if (action == ActionState.New)
            {
                try
                {
                    Customer1  customer  = (Customer1)cmbCustomer1.SelectedItem;
                    Inventory1 inventory = (Inventory1)cmbInventory1.SelectedItem;
                    //instantiem Order entity
                    order = new Order1()
                    {
                        CustId = customer.CustId,
                        CarId  = inventory.CarId
                    };
                    //adaugam entitatea nou creata in context
                    ctx.Order1.Add(order);
                    customerViewSource.View.Refresh();
                    //salvam modificarile
                    ctx.SaveChanges();
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Inventory1 inventory1 = db.Inventory1.Find(id);

            db.Inventory1.Remove(inventory1);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 //public int goldvalue=3;
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("il ya deja une autre instance");
         return;
     }
     instance = this;
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "ID,Flower,Price,Availability")] Inventory1 inventory1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inventory1).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(inventory1));
 }
コード例 #5
0
        public ActionResult Create([Bind(Include = "ID,Flower,Price,Availability")] Inventory1 inventory1)
        {
            if (ModelState.IsValid)
            {
                db.Inventory1.Add(inventory1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(inventory1));
        }
コード例 #6
0
        // GET: Inventory1/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Inventory1 inventory1 = db.Inventory1.Find(id);

            if (inventory1 == null)
            {
                return(HttpNotFound());
            }
            return(View(inventory1));
        }
コード例 #7
0
ファイル: pickup1.cs プロジェクト: tingng123/newdynamic
 // Start is called before the first frame update
 private void Start()
 {
     inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory1>();
 }