public string Save(BookRoomModel bookRoom)
        {
            int rowEffect = bookRoomGateway.Save(bookRoom);


            if (rowEffect > 0)
            {
                return("Save Successful");
            }
            else
            {
                return("Save Faild");
            }
        }
        public ActionResult Save(BookRoomModel bookRoom)
        {
            ViewBag.categorys = roomInfoManager.GetAllCategory();
            string name = IsPossible(bookRoom.SelectDate, bookRoom.RoomId);

            if (name == "")
            {
                ViewBag.message = bookRoomManager.Save(bookRoom);
            }
            else
            {
                ViewBag.message = "This schedule is already booked by " + name;
            }
            return(View());
        }
Ejemplo n.º 3
0
        private async void Book_Clicked(object sender, EventArgs e)
        {
            BookRoomModel bookRoom = new BookRoomModel();


            bookRoom.UserUID = await _firebaseAuth.GetCurrentUser();

            bookRoom.Room   = Room;
            bookRoom.Key    = "00";
            bookRoom.Date   = getTodayDate();
            bookRoom.Amount = Room.Amount;
            bookRoom.Status = "Pending";
            bookRoom.From   = from.Date.ToLocalTime().ToShortDateString();
            bookRoom.To     = to.Date.ToLocalTime().ToShortDateString();
            bookRoom.Hotel  = BHotel;

            _firebaseDatabase.SetBooking("hotelbookings", bookRoom);

            await DisplayAlert("Booking", "Your room is booked", "OK");

            await Navigation.PopAsync();
        }
        public int Save(BookRoomModel bookRoom)
        {
            query = "INSERT INTO BookRoomTable VALUES(@CategoryId, @RoomId,@SelectedDate, @BookedBy, @Address)";


            Command = new SqlCommand(query, Connection);
            Command.Parameters.AddWithValue("@CategoryId", bookRoom.CategoryId);
            Command.Parameters.AddWithValue("@RoomId", bookRoom.RoomId);
            Command.Parameters.AddWithValue("@SelectedDate", bookRoom.SelectDate);
            Command.Parameters.AddWithValue("@BookedBy", bookRoom.BookedBy);
            Command.Parameters.AddWithValue("@Address", bookRoom.Address);



            Connection.Open();

            int rowEffect = Command.ExecuteNonQuery();

            Connection.Close();

            return(rowEffect);
        }