public void RequestOutsiderangeTest()
        {
            HotelBusiness hb = new HotelBusiness();

            hb.InsertRooms(1);
            Assert.AreEqual(hb.BookRoom((-4, 2)), false);
            Assert.AreEqual(hb.BookRoom((200, 400)), false);
        }
        public void RequestsAreDeclinedTest()
        {
            HotelBusiness hb = new HotelBusiness();

            hb.InsertRooms(3);
            Assert.AreEqual(hb.BookRoom((1, 3)), true);
            Assert.AreEqual(hb.BookRoom((2, 5)), true);
            Assert.AreEqual(hb.BookRoom((1, 9)), true);
            Assert.AreEqual(hb.BookRoom((0, 15)), false);
        }
Exemple #3
0
        public IActionResult HotelDetail()
        {
            HotelBusiness business    = new HotelBusiness();
            int           hotelId     = Convert.ToInt32(RouteData.Values["id"]);
            var           hotelDetail = business.GetHotelDetail(hotelId);

            ViewBag.HotelContact = business.GetHotelContact(hotelId);
            ViewBag.HotelComment = business.GetHotelComment(hotelId);
            return(View(hotelDetail));
        }
        public void RequestsCanBeAcceptedAfterDeclineTest()
        {
            HotelBusiness hb = new HotelBusiness();

            hb.InsertRooms(3);
            Assert.AreEqual(hb.BookRoom((1, 3)), true);
            Assert.AreEqual(hb.BookRoom((0, 15)), true);
            Assert.AreEqual(hb.BookRoom((1, 9)), true);
            Assert.AreEqual(hb.BookRoom((2, 5)), false);
            Assert.AreEqual(hb.BookRoom((4, 9)), true);
        }
        private List <Hotel> GetTestHotels()
        {
            var hotelbuisness = new HotelBusiness();
            var hotels        = hotelbuisness.GetHotels();

            if (hotels != null)
            {
                var data = hotels.Hotels;
                return(data);
            }
            return(new List <Hotel>());
        }
        public void RequestsAreAcceptedTest()
        {
            HotelBusiness hb = new HotelBusiness();

            hb.InsertRooms(3);
            Assert.AreEqual(hb.BookRoom((0, 5)), true);
            Assert.AreEqual(hb.BookRoom((7, 13)), true);
            Assert.AreEqual(hb.BookRoom((3, 9)), true);
            Assert.AreEqual(hb.BookRoom((5, 7)), true);
            Assert.AreEqual(hb.BookRoom((6, 6)), true);
            Assert.AreEqual(hb.BookRoom((0, 4)), true);
        }
Exemple #7
0
 protected View()
 {
     ClientRepository  = new Repository <ClientEntity>();
     RoomRepository    = new Repository <RoomEntity>();
     BookingRepository = new Repository <BookingEntity>();
     ClientBusiness    = new ClientBusiness(ClientRepository);
     RoomBusiness      = new RoomBusiness(RoomRepository);
     HotelBusiness     = new HotelBusiness(RoomRepository);
     BookingBusiness   = new BookingBusiness(RoomRepository, BookingRepository);
     BookingServices   = new BookingServices(BookingBusiness, ClientBusiness, RoomBusiness);
     RoomServices      = new RoomServices(RoomBusiness);
     ClientServices    = new ClientServices(ClientBusiness);
     HotelServices     = new HotelServices(HotelBusiness);
 }
Exemple #8
0
        public IActionResult HotelComment(string hotelComment, int hotelCommentScore, int hotelId)
        {
            int?         userID       = HttpContext.Session.GetInt32("UserId");
            HotelComment hotelcomment = new HotelComment();

            hotelcomment.HotelId = hotelId;
            hotelcomment.UserId  = userID;
            hotelcomment.Comment = hotelComment;
            hotelcomment.Score   = hotelCommentScore;
            HotelBusiness business = new HotelBusiness();

            business.AddHotelComment(hotelcomment);
            return(RedirectToAction("Index", "Hotel"));
        }
        public void ComplexRequestTest()
        {
            HotelBusiness hb = new HotelBusiness();

            hb.InsertRooms(2);
            Assert.AreEqual(hb.BookRoom((1, 3)), true);
            Assert.AreEqual(hb.BookRoom((0, 4)), true);
            Assert.AreEqual(hb.BookRoom((2, 3)), false);
            Assert.AreEqual(hb.BookRoom((5, 5)), true);
            Assert.AreEqual(hb.BookRoom((4, 10)), true);
            Assert.AreEqual(hb.BookRoom((10, 10)), true);
            Assert.AreEqual(hb.BookRoom((6, 7)), true);
            Assert.AreEqual(hb.BookRoom((8, 10)), false);
            Assert.AreEqual(hb.BookRoom((8, 9)), true);
        }
Exemple #10
0
        public IActionResult Index(string searchString)
        {
            HotelBusiness business = new HotelBusiness();

            ViewBag.AllHotels = business.GetHotels();

            if (string.IsNullOrEmpty(searchString))
            {
                return(View());
            }
            else
            {
                ViewBag.SearchedHotels = business.GetHotelSearchResult(searchString);
            }

            return(View());
        }
 public IEnumerable <Hotel> GetAllHotels()
 {
     try
     {
         var hotelbuisness = new HotelBusiness();
         var hotels        = hotelbuisness.GetHotels();
         if (hotels != null)
         {
             data = hotels.Hotels;
             return(data);
         }
         return(new List <Hotel>());
     }
     catch (Exception)
     {
         return(new List <Hotel>());
     }
 }
        // GET: Contactenos
        public ActionResult Contactenos()
        {
            HotelBusiness hotelBusiness = new HotelBusiness();
            List <Hotel>  hoteles       = hotelBusiness.obtenerHotelesBusiness();

            foreach (Hotel hotel in hoteles)
            {
                ViewData["descripcion"] = hotel.SobreNosotrosHotel + "";
            }


            ImagenBusiness imagenBusiness = new ImagenBusiness();
            List <Imagen>  imagenes       = imagenBusiness.obtenerImagenes();

            return(View(imagenes));

            /*
             *
             * return View(hoteles);
             *
             *
             *
             */
        }
Exemple #13
0
 public HotelModel(String connectionString)
 {
     this.hotelBusiness = new HotelBusiness(connectionString);
 }
Exemple #14
0
 public RepositoryHotel(string connectionString)
 {
     this.hotelBusiness = new HotelBusiness(connectionString);
 }