//filtered list.
        //public Acknowledgement<Room> GetFilteredData(SearchedRoomData data)
        //{
        //    Acknowledgement<Room> payload = new Acknowledgement<Room>();
        //    try
        //    {
        //        List<Room> list;
        //        SearchCityTypeService service = new SearchCityTypeService();
        //        list = service.GetFilteredRooms(data);
        //        if(list.Count>0)
        //        {
        //            payload.code = 1;
        //            payload.Set = list;
        //            payload.Message = "Success";
        //        }
        //        else if(list.Count==0)
        //        {
        //            payload.code = 0;
        //            payload.Set = list;
        //            payload.Message = "No records found";
        //        }
        //        return payload;

        //    }
        //    catch(Exception error)
        //    {
        //        throw error;
        //    }
        //}

        public virtual Acknowledgement <Book> AddToBooking(Book toBeBooked)
        {
            Acknowledgement <Book> returnBooked = new Acknowledgement <Book>();
            List <Book>            bookingList  = new List <Book>();
            //     bookingService bookingService = new bookingService();
            List <int> roomIds           = new List <int>();
            List <int> userIds           = new List <int>();
            bool       isRoomIdPresent   = false;
            bool       isRenterIdPresent = false;
            User       userToCheck       = new User();
            Room       roomToCheck       = new Room();
            string     renterConfirmationMessage;
            string     partnerConfirmationMessage;
            string     partnerEmailAddress;
            User       ownerOfThisRoom = new User();

            try
            {
                roomIds = bookingService.RoomIdList();
                userIds = bookingService.RenterIdList();
                foreach (int i in roomIds)
                {
                    if (i == toBeBooked.RoomId)
                    {
                        isRoomIdPresent = true;
                        break;
                    }
                }
                foreach (int i in userIds)
                {
                    if (i == toBeBooked.RenterId)
                    {
                        isRenterIdPresent = true;
                        break;
                    }
                }
                if (isRenterIdPresent == false)
                {
                    throw new RenterIdNotThere();
                }

                userToCheck = bookingService.GetUserToCheck(toBeBooked.RenterId);

                if (!(userToCheck.UserType.ToLower().Equals("renter")))
                {
                    throw new UserIsNotRenter();
                }

                if (userToCheck.UserStatus.ToLower().Equals("invalid"))
                {
                    throw new UserStatusInvalid();
                }

                if (isRoomIdPresent == false)
                {
                    throw new RoomIdNotThere();
                }

                roomToCheck = bookingService.GetRoomToCheck(toBeBooked);

                if (roomToCheck.Status.ToLower().Equals("unavailable"))
                {
                    throw new RoomAlreadyBooked(toBeBooked.RoomId);
                }

                toBeBooked = bookingService.AddToBooking(toBeBooked);
                bookingList.Add(toBeBooked);

                returnBooked.code    = 1;
                returnBooked.Set     = bookingList;
                returnBooked.Message = "Successfully, booked the room. ";

                ownerOfThisRoom           = bookingService.GetOwnerOfTheRoom(toBeBooked.RoomId);
                renterConfirmationMessage = ConfirmationMailForRenter(userToCheck, roomToCheck, ownerOfThisRoom);
                returnBooked.Message      = returnBooked.Message + renterConfirmationMessage;

                partnerConfirmationMessage = ConfirmationMailForPartner(ownerOfThisRoom, roomToCheck, userToCheck);

                returnBooked.Message = returnBooked.Message + partnerConfirmationMessage;
            }
            catch (UserStatusInvalid userStatusInvalidEx)
            {
                throw userStatusInvalidEx;
            }
            catch (UserIsNotRenter userIsNotRenterEx)
            {
                throw userIsNotRenterEx;
            }
            catch (RoomAlreadyBooked roomAlreadyBookedEx)
            {
                throw roomAlreadyBookedEx;
            }
            catch (RenterIdNotThere renterIdNotThereException)
            {
                throw renterIdNotThereException;
            }
            catch (RoomIdNotThere roomIdNotThereException)
            {
                throw roomIdNotThereException;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            //  partnerConfirmationMessage= ConfirmationMailForPartner()

            return(returnBooked);
        }
 // GET: Rooms
 public ActionResult AddToBooking(int id)
 {
     bookingService.AddToBooking(this.HttpContext, id, 1);//always add one to the booking
     return(RedirectToAction("BookingSummary"));
 }