Пример #1
0
        public void ChangeTamagotchiStats()
        {
            // tamagotchis with NO booking
            var tamagotchis = _tamagotchiRepository.GetAllTamagotchisALiveAndNoHotelRoom();

            this.HotelRoomBookingStayOverNight("No room", tamagotchis);

            foreach (var tamagotchi in tamagotchis)
            {
                _tamagotchiRepository.Edit(tamagotchi);
            }

            // tamagotchis with booking
            var hotelBookingsVM = _hotelBookingRepository.GetAll().Select(h => new HotelBookingVM(h)).ToList();

            foreach (var hotelBookingVM in hotelBookingsVM)
            {
                this.HotelRoomBookingStayOverNight(hotelBookingVM.RoomType, hotelBookingVM.Tamagotchis);

                foreach (var tamagotchi in hotelBookingVM.Tamagotchis)
                {
                    _tamagotchiRepository.Edit(tamagotchi);
                }
                _hotelBookingRepository.Delete(hotelBookingVM.ToModel());
            }
        }
        // GET: HotelBookings
        public ActionResult Index()
        {
            ViewBag.AmountOfTamagotchisLeft = _tamagotchiRepository.GetAllTamagotchisALiveAndNoHotelRoom().Count();
            ViewBag.AmountOfHotelRoomsLeft  = _hotelRoomRepository.GetAllHotelRoomsWhereBookingIsNull().Count();

            List <HotelBookingVM> hotelBookingsVM = _hotelBookingRepository.GetAll().Select(h => new HotelBookingVM(h)).ToList();

            return(View(hotelBookingsVM));
        }