/// <summary> /// Booking method will returns List of History based on parameter "id" /// </summary> /// <param name="id"></param> /// <returns>List</returns> public List <History> Booking(int id) { //Storing the History List into parameter bookingHistory which is obtained from LINQ statement using (BookMyRoomDBContext db = new BookMyRoomDBContext()) { var bookingHistory = (from RBD in db.roomBookingDetails join UD in db.userDetails on RBD.userId equals UD.userId join B in db.booking on RBD.bookingId equals B.bookingId join RD in db.roomHotel on RBD.roomId equals RD.roomId join HD in db.hotelDetails on RD.hotelId equals HD.hotelId where id == UD.userId select new History { hotelId = HD.hotelId, hotelName = HD.hotelName, hotelCity = "", hotelAddress = HD.hotelAddress, bookingDate = B.bookingDate, bookingId = B.bookingId, checkInDate = B.checkInDate, checkOutDate = B.checkOutDate }).ToList(); return(bookingHistory); } }