예제 #1
0
 public static int SaveCusRegistration(CustomerRegestration insertCusreg)
 {
     using (HotelBookingsEntities db = new HotelBookingsEntities())
     {
         db.CustomerRegestrations.Add(insertCusreg);
         db.SaveChanges();
         return(insertCusreg.CustomerID);
     }
 }
예제 #2
0
 public static void DeleteRecord(string insertCusreg)
 {
     using (HotelBookingsEntities db = new HotelBookingsEntities())
     {
         CustomerRegestration c = db.CustomerRegestrations.SingleOrDefault(x => x.CustomerID.ToString().Trim() == insertCusreg.Trim());
         if (c != null)
         {
             db.CustomerRegestrations.Remove(c);
             db.SaveChanges();
         }
     }
 }
예제 #3
0
        public static int UpdateCusRegistration(CustomerRegestration insertCusreg)
        {
            using (HotelBookingsEntities db = new HotelBookingsEntities())
            {
                //Lembda expression

                CustomerRegestration c = db.CustomerRegestrations.SingleOrDefault(x => x.CustomerID == insertCusreg.CustomerID);
                c.FirstNAME = insertCusreg.FirstNAME;
                c.LastNAME  = insertCusreg.LastNAME;
                c.EMAILID   = insertCusreg.EMAILID;
                c.PHONE     = insertCusreg.PHONE;
                db.SaveChanges();
                return(insertCusreg.CustomerID);
            }
        }