コード例 #1
0
 public static void Checkin_Reservation(string Customer, int ID)
 {
     using (var db = new DBConnection())
     {
         var reservation = db.DbReservation.Where(item => item.checkin == false && item.id == ID && item.customer_telephone == Customer).FirstOrDefault();
         reservation.checkin         = true;
         db.Entry(reservation).State = EntityState.Modified;
         var customer = db.DbMemberShip.Where(item => item.phone_number == Customer && item.flag == false).FirstOrDefault();
         customer.score           = customer.score + TableAction.Find_Table_By_ID(ID).seats * 2;
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         db.Dispose();
     }
 }
コード例 #2
0
 public static void Create_Reservation(string Customer_Phone, int Id_Table)
 {
     using (var db = new DBConnection())
     {
         db.DbReservation.Add(new TableReservation {
             customer_telephone = Customer_Phone,
             id_table           = Id_Table,
             flag        = false,
             cancel      = false,
             seats       = TableAction.Find_Table_By_ID(Id_Table).seats,
             fullname    = MemberShipAction.Find_MemberShip_By_Phone(Customer_Phone).fullname,
             time_create = DateTime.Now,
             checkin     = false
         });
         db.SaveChanges();
         db.Dispose();
     }
 }