/// <summary>
        /// Called when a SINGLE ROOM IS BOOKED
        /// </summary>
        /// <returns></returns>
        public JsonResult Book(BookingDetails bookingDetails)
        {
            Guid guid = Guid.NewGuid();
            var bookingConfirmationDetails = new Models.BookingConfirmation { BookingId = guid.ToString(), ReservationId = guid.ToString() };
            // BookingDetails bookingDetails = new BookingDetails { CityId = 1, GuestId = "1", CheckinDate = "6/5/2013", CheckoutDate = "6/12/2013", NumberOfAdults = 2, RoomTypeID = "3" };

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["defaultConnection"].ConnectionString);
            SqlCommand cmd = new SqlCommand("sp_book_room", conn);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@BranchID", bookingDetails.CityId);
            cmd.Parameters.AddWithValue("@ReservationNumber", bookingConfirmationDetails.ReservationId);
            cmd.Parameters.AddWithValue("@FromDate", bookingDetails.CheckinDate);
            cmd.Parameters.AddWithValue("@ToDate", bookingDetails.CheckoutDate);
            cmd.Parameters.AddWithValue("@RoomTypeID", int.Parse(bookingDetails.RoomTypeID));
            cmd.Parameters.AddWithValue("@CustomerId", 1);
            SqlParameter param = new SqlParameter("@RtnValue", SqlDbType.Int);
            param.Direction = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(param);
            conn.Open();
            cmd.ExecuteScalar();
            conn.Close();
            if ((int)cmd.Parameters["@RtnValue"].Value != 0)
            {
                return null;
            }

            return Json(bookingConfirmationDetails, JsonRequestBehavior.AllowGet);
        }
        public IEnumerable<AvailableRoom> Get(BookingDetails details)
        {
            var availableRooms = new List<AvailableRoom>() {
                   new AvailableRoom() { Description = "Minimalist room for the economist traveller.", Name = "Sleep Dorm", Id = "1" },
                    new AvailableRoom() { Description = "Just the basics - bed and bathroom with shower.", Name = "RnR", Id = "2" },
                    new AvailableRoom() { Description = "Bedroom with workspace for the business traveller.", Name = "Working Suite", Id = "3" },
                    new AvailableRoom() { Description = "Private office space with minimalist sleeping quarters.", Name = "Office Away", Id = "4" },
                    new AvailableRoom() { Description = "Sleeping, living and dining accomodations.", Name = "Home Away", Id = "5" }};

            return availableRooms;
        }
        /// <summary>
        /// This gives search results
        /// </summary>
        /// <returns></returns>
        public JsonResult GetRooms(BookingDetails bookingDetails)
        {
            // BookingDetails bookingDetails = new BookingDetails { CityId = 1, GuestId = "1", CheckinDate = "6/5/2013", CheckoutDate = "6/12/2013", NumberOfAdults = 2 };

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
            SqlCommand cmd = new SqlCommand("sp_get_availability", conn);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@BranchID", bookingDetails.CityId);
            cmd.Parameters.AddWithValue("@FromDate", bookingDetails.CheckinDate);
            cmd.Parameters.AddWithValue("@ToDate", bookingDetails.CheckoutDate);
            cmd.Parameters.AddWithValue("@IncludePartner", 0);
            SqlParameter param = new SqlParameter("@RtnValue", SqlDbType.Int);
            param.Direction = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(param);

            SqlDataAdapter adpter = new SqlDataAdapter(cmd);
            DataSet dataSet = new DataSet();
            adpter.Fill(dataSet);

            if ((int)cmd.Parameters["@RtnValue"].Value != 0)
            {
                return null;
            }

            if (dataSet == null || dataSet.Tables == null || dataSet.Tables.Count == 0 || dataSet.Tables[0].Rows == null || dataSet.Tables[0].Rows.Count == 0)
            {
                return null;
            }

            var availableRooms = new List<AvailableRoom>();

            foreach (DataRow dataRow in dataSet.Tables[0].Rows)
            {
                AvailableRoom availableRoom = new AvailableRoom();
                availableRoom.Id = dataRow["RoomTypeID"].ToString();
                availableRoom.Name = dataRow["TypeName"].ToString();
                availableRoom.Description = dataRow["facilities"].ToString();
                availableRooms.Add(availableRoom);
            }

            return Json(availableRooms, JsonRequestBehavior.AllowGet);
        }