Ejemplo n.º 1
0
        public ActionResult AddComment(string country, string city, int guestnumber = 0, int bednumber = 0, DateTime?bookfrom = null, DateTime?bookto = null, string type = "Hotel", int id = 0, string text = "")
        {
            ApplicationUser user   = repository.GetUserById(GetUserId());
            bool            Succes = false;

            if (type == "Hotel")
            {
                Hotel hotel = repository.GetHotelByID(id);
                Succes = repository.AddComment(null, hotel, user, text);
            }
            else
            {
                Resort resort = repository.GetResortByID(id);
                Succes = repository.AddComment(resort, null, user, text);
            }


            if (Succes)
            {
                FiltrResortHotel filtrclass = filtr;
                filtrclass.Country     = country;
                filtrclass.City        = city;
                filtrclass.GuestNumber = guestnumber;
                filtrclass.BedNumber   = bednumber;
                filtrclass.BookFrom    = bookfrom == null ? DateTime.MinValue : (DateTime)bookfrom;
                filtrclass.BookTo      = bookto == null ? DateTime.MinValue : (DateTime)bookto;



                filtrclass.Filtr();


                SearchModelViewResortHotel viewmodel = new SearchModelViewResortHotel();
                viewmodel.Hotels  = filtrclass.Hotels;
                viewmodel.Resorts = filtrclass.Resorts;
                viewmodel.ResortListOfHolidayHomes = filtrclass.ResortListOfHolidayHomes;
                viewmodel.ResortListOfRooms        = filtrclass.ResortListOfRooms;
                viewmodel.HotelListOfRooms         = filtrclass.HotelListOfRooms;



                return(View("FiltrResortHotel", viewmodel));
            }
            else
            {
                return(View("Error"));
            }
        }