Exemplo n.º 1
0
 public bool create(Bill_details billDetail)
 {
     try
     {
         billDetail.created_at = DateTime.Now;
         billDetail.updated_at = DateTime.Now;
         db.Bill_details.Add(billDetail);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemplo n.º 2
0
 public bool update(Bill_details billdetail, int id_bill, int id_food)
 {
     try
     {
         billdetail.updated_at = DateTime.Now;
         (from billdt in db.Bill_details
          where billdt.id_bill == id_bill && billdt.id_food == id_food
          select billdt)
         .ToList()
         .ForEach((p) =>
         {
             p.quantity = billdetail.quantity;
             p.price    = billdetail.price;
         });
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }