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

            db.Items.Remove(item);
            db.SaveChanges();
        }
예제 #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;
        }
예제 #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;
        }
예제 #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;
        }
예제 #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();
        }
예제 #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();
        }
예제 #7
0
        public Item getItems(int id)
        {
            var db = new MyDataBaseSuperMarketEntities();

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

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