public HotelDetails GetHotelDetails(string Hid) { using (ServiceHotelContextCls W = new ServiceHotelContextCls()) { return(W.hotels.Where(x => x.HotelId == Hid).FirstOrDefault()); } }
public List <HotelDetails> getallhotel() { using (ServiceHotelContextCls gethotels = new ServiceHotelContextCls()) { var allhotel = from Gh in gethotels.hotels select Gh; return(allhotel.ToList()); } }
public string InsertRoomDetails(RoomDetails Inroomdetails) { try { ServiceHotelContextCls TC = new ServiceHotelContextCls(); TC.rooms.Add(Inroomdetails); TC.SaveChanges(); return("1 Row Inserted"); } catch (DbUpdateException Ex) { SqlException sql = (SqlException)Ex.GetBaseException(); return(sql.Message); } }
public string InsertCity(City Incity) { try { ServiceHotelContextCls TC = new ServiceHotelContextCls(); TC.cities.Add(Incity); TC.SaveChanges(); return("1 Row Inserted"); } catch (DbUpdateException Ex) { SqlException sql = (SqlException)Ex.GetBaseException(); return(sql.Message); } }
public string Addhotel(HotelDetails AH) { try { ServiceHotelContextCls TC = new ServiceHotelContextCls(); TC.hotels.Add(AH); TC.SaveChanges(); return("Record Saved Successfully"); } catch (DbUpdateException Ex) { SqlException sql = (SqlException)Ex.GetBaseException(); return(sql.Message); } catch (Exception EE) { return("Please Try Again"); } }
public string Removehotel(string RH) { using (ServiceHotelContextCls Delhotel = new ServiceHotelContextCls()) { try { var res = (from D1 in Delhotel.hotels where D1.HotelId == RH select D1).FirstOrDefault(); Delhotel.hotels.Remove(res); Delhotel.SaveChanges(); return("Data Deleted Successfully"); } catch (DbUpdateException Ex) { SqlException sql = (SqlException)Ex.GetBaseException(); return(sql.Message); } } }