//Add a record to guest details table public static int AddRecord(eBiddingSearch eobj) { int retval = 0; using (OneFineRateEntities db = new OneFineRateEntities()) { try { GuestUserDetails objDetail = new GuestUserDetails(); objDetail.Title = eobj.sUserTitle; objDetail.FirstName = eobj.sUserFirstName; objDetail.LastName = eobj.sUserLastName; objDetail.Email = eobj.sUserEmail; objDetail.PhoneNumber = eobj.sUserMobileNo; OneFineRate.tblWebsiteGuestUserMaster dbuser = (OneFineRate.tblWebsiteGuestUserMaster)OneFineRateAppUtil.clsUtils.ConvertToObject(objDetail, new OneFineRate.tblWebsiteGuestUserMaster()); db.tblWebsiteGuestUserMasters.Add(dbuser); db.SaveChanges(); retval = Convert.ToInt32(dbuser.Id); } catch (Exception) { throw; } } return(retval); }
//Add Guest Details public static int AddGuestDetailsRecord(GuestUserDetails objDetail) { int retval = 0; using (OneFineRateEntities db = new OneFineRateEntities()) { try { OneFineRate.tblWebsiteGuestUserMaster dbuser = (OneFineRate.tblWebsiteGuestUserMaster)OneFineRateAppUtil.clsUtils.ConvertToObject(objDetail, new OneFineRate.tblWebsiteGuestUserMaster()); db.tblWebsiteGuestUserMasters.Add(dbuser); db.SaveChanges(); retval = Convert.ToInt32(dbuser.Id); } catch (Exception) { throw; } } return(retval); }
public static int AddRecord(PropDetailsM eobj) { int retval = 0; using (OneFineRateEntities db = new OneFineRateEntities()) { try { GuestUserDetails objDetail = new GuestUserDetails(); objDetail.Title = eobj.sUserTitle; objDetail.FirstName = eobj.sUserFirstName; objDetail.LastName = eobj.sUserLastName; objDetail.Email = eobj.sUserEmail; objDetail.PhoneNumber = eobj.sUserMobileNo; objDetail.sCountryPhoneCode = eobj.sCountryPhoneCode; objDetail.iStateId = eobj.iStateId; OneFineRate.tblWebsiteGuestUserMaster dbuser = (OneFineRate.tblWebsiteGuestUserMaster)OneFineRateAppUtil.clsUtils.ConvertToObject(objDetail, new OneFineRate.tblWebsiteGuestUserMaster()); if (eobj.objBooking.iBookingId > 0) { var guestId = db.tblBookingTxes.Where(x => x.iBookingId == eobj.objBooking.iBookingId).Select(x => x.iGuestId).SingleOrDefault(); dbuser.Id = guestId == null ? 0 : guestId.Value; db.tblWebsiteGuestUserMasters.Attach(dbuser); db.Entry(dbuser).State = System.Data.Entity.EntityState.Modified; } else { db.tblWebsiteGuestUserMasters.Add(dbuser); } db.SaveChanges(); retval = Convert.ToInt32(dbuser.Id); } catch (Exception) { throw; } } return(retval); }