private void button1_Click(object sender, EventArgs e) { int Qid = Convert.ToInt32(lblOrderID.Text); var myOrder = db.Orders.FirstOrDefault(x => x.OrderID == Qid); myOrder.PaymentStatusID = 1; myOrder.FoodStatusID = 1; db.SaveChanges(); ////////////////////////////////////////////////////////////////////// OrderDetail od = new OrderDetail(); int productid = Convert.ToInt32(lblpid.Text); var myProduct = db.Products.FirstOrDefault(x => x.ProductID == productid); od.OrderID = Qid; od.ProductID = Convert.ToInt32(lblpid.Text); decimal price = Convert.ToDecimal(myProduct.ProductPrice * numericUpDown1.Value); od.Price = price; OrderDetailRepository odr = new OrderDetailRepository(); odr.Add(od); Bill bill = new Bill(); bill.CustomerID = myOrder.CustomerID; bill.OrderID = myOrder.OrderID; bill.BillAmount = price; bill.CreatorID = myOrder.CreatorID; BillRepository br = new BillRepository(); br.Add(bill); }
public void Add(Bill bill) { billRepository.Add(bill); }