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);
                }
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Inventory1 inventory1 = db.Inventory1.Find(id);

            db.Inventory1.Remove(inventory1);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
 //public int goldvalue=3;
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("il ya deja une autre instance");
         return;
     }
     instance = this;
 }
 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));
 }
        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));
        }
        // 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));
        }
Exemple #7
0
 // Start is called before the first frame update
 private void Start()
 {
     inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory1>();
 }