public bool create(Bill_Online_Detail bill_Online_Detail) { try { bill_Online_Detail.created_at = DateTime.Now; bill_Online_Detail.updated_at = DateTime.Now; db.Bill_Online_Detail.Add(bill_Online_Detail); db.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool update(Bill_Online_Detail billdetail, int id_bill, int id_food) { try { billdetail.updated_at = DateTime.Now; (from billdt in db.Bill_Online_Detail where billdt.id_bill == id_bill && billdt.id_drink == id_food select billdt) .ToList() .ForEach((p) => { p.quantity = billdetail.quantity; p.price = billdetail.price; }); db.SaveChanges(); return(true); } catch (Exception e) { return(false); } }