Пример #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);
            }
        }