Beispiel #1
0
        public void DeleteItem(int id)
        {
            var item = new Item();
            var db   = new MyDataBaseSuperMarketEntities();

            db.Items.Remove(item);
            db.SaveChanges();
        }
Beispiel #2
0
        public void ViewAmount()
        {
            var item = new Item();
            var db   = new MyDataBaseSuperMarketEntities();

            Item[] list          = db.Items.ToArray();
            var    orderByAmount = from amount in list
                                   orderby amount.Amount
                                   select amount;
        }
Beispiel #3
0
        public void ViewPrice()
        {
            var item = new Item();
            var db   = new MyDataBaseSuperMarketEntities();

            Item[] list         = db.Items.ToArray();
            var    orderByPrice = from price in list
                                  orderby price.Price
                                  select price;
        }
Beispiel #4
0
        public void ViewAZ()
        {
            var item = new Item();
            var db   = new MyDataBaseSuperMarketEntities();

            Item[] list      = db.Items.ToArray();
            var    orderByAZ = from name in list
                               orderby name.Name
                               select name;
        }
Beispiel #5
0
        public void UpdateItem(int id, string name, int producer, int price, int amount)
        {
            var item = new Item();

            item.Name     = name;
            item.Producer = producer;
            item.Amount   = amount;

            var db = new MyDataBaseSuperMarketEntities();

            db.Entry(item).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Beispiel #6
0
        public void addItem(string code, string name, int producer, int price, int amount)
        {
            var item = new Item();

            item.Code     = code;
            item.Name     = name;
            item.Producer = producer;
            item.Amount   = amount;

            var db = new MyDataBaseSuperMarketEntities();

            db.Items.Add(item);
            db.SaveChanges();
        }
Beispiel #7
0
        public Item getItems(int id)
        {
            var db = new MyDataBaseSuperMarketEntities();

            return(db.Items.Find(id));
        }
Beispiel #8
0
        public Item[] getItem()
        {
            var db = new MyDataBaseSuperMarketEntities();

            return(db.Items.ToArray());
        }