예제 #1
0
 public HotelDetails GetHotelDetails(string Hid)
 {
     using (ServiceHotelContextCls W = new ServiceHotelContextCls())
     {
         return(W.hotels.Where(x => x.HotelId == Hid).FirstOrDefault());
     }
 }
예제 #2
0
 public List <HotelDetails> getallhotel()
 {
     using (ServiceHotelContextCls gethotels = new ServiceHotelContextCls())
     {
         var allhotel = from Gh in gethotels.hotels
                        select Gh;
         return(allhotel.ToList());
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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");
            }
        }
예제 #6
0
        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);
                }
            }
        }