Beispiel #1
0
        // Nếu món tồn tại rồi thì chỉnh sửa BillInfor(new Quantity)
        public void EditNewQuantityBillInfor(int QuantityAdd, int FoodID, int BillID)
        {
            TblBillInfor newBillInfor = new TblBillInfor();

            newBillInfor        = data.TblBillInfors.Single(n => n.BillID == BillID && n.FoodID == FoodID);
            newBillInfor.CountF = GetFoodQuantity(FoodID, BillID) + QuantityAdd;
            newBillInfor.Total  = (GetFoodQuantity(FoodID, BillID) + QuantityAdd) * data.TblFoods.First(n => n.ID == FoodID).Price;
            data.SaveChanges();
        }
Beispiel #2
0
        public void EditBillInfor(int Quantity, int FoodID, int BillID)
        {
            TblBillInfor newBillInfor = new TblBillInfor();

            newBillInfor        = data.TblBillInfors.Single(n => n.BillID == BillID && n.FoodID == FoodID);
            newBillInfor.CountF = Quantity;
            newBillInfor.Total  = Quantity * data.TblFoods.First(n => n.ID == FoodID).Price;
            data.SaveChanges();
        }
Beispiel #3
0
        // Nếu món ấy chưa tồn tại thì tạo BillInfor mới (input: IDBill+FoodID output: null)
        public void AddBillInfor(int FoodID, int BillID, int Quantity)
        {
            TblBillInfor newBillInfor = new TblBillInfor()
            {
                BillID = BillID,
                FoodID = FoodID,
                CountF = Quantity,
                Total  = Quantity * data.TblFoods.First(n => n.ID == FoodID).Price
            };

            data.TblBillInfors.Add(newBillInfor);
            data.SaveChanges();
        }