Exemple #1
0
 public HomeController(ILogger <HomeController> logger
                       , MealPlanRepository mealPlanRepository,
                       RoomRepository roomRepository,
                       ReservationRepository reservationRepository,
                       MealPlanPricesRepository mealPlanPricesRepository,
                       RoomPricesRepository roomPricesRepository)
 {
     _logger = logger;
 }
Exemple #2
0
 public Booking(ReservationRepository reservationRepository, RoomRepository roomRepository,
                RoomPricesRepository roomPricesRepository, MealPlanRepository mealPlanRepository,
                MealPlanPricesRepository mealPlanPricesRepository, GuestRepository guestRepository)
 {
     _reservationRepository    = reservationRepository;
     _roomRepository           = roomRepository;
     _roomPricesRepository     = roomPricesRepository;
     _mealPlanRepository       = mealPlanRepository;
     _mealPlanPricesRepository = mealPlanPricesRepository;
     _guestRepository          = guestRepository;
 }
        public static void Seed(IServiceProvider serviceProvider)
        {
            #region Room
            RoomRepository roomRepository =
                serviceProvider.GetRequiredService <RoomRepository>();

            if (!roomRepository.GetAllRooms().Any())
            {
                roomRepository.AddRange(DbInitializer.GetRooms());
            }


            #endregion

            #region RoomPrices

            RoomPricesRepository roomPricesRepository =
                serviceProvider.GetRequiredService <RoomPricesRepository>();

            if (!roomPricesRepository.GetAllRoomPrices().Any())
            {
                roomPricesRepository.AddRange(DbInitializer.getRoomPrices());
            }

            #endregion

            #region MealPlan

            MealPlanRepository mealPlanRepository =
                serviceProvider.GetRequiredService <MealPlanRepository>();

            if (!mealPlanRepository.GetAllMealPlans().Any())
            {
                mealPlanRepository.AddRange(DbInitializer.getMealPlans());
            }

            #endregion

            #region MealPlanPrices

            MealPlanPricesRepository mealPlanPricesRepository =
                serviceProvider.GetRequiredService <MealPlanPricesRepository>();

            if (!mealPlanPricesRepository.GetAllMealPlansPrices().Any())
            {
                mealPlanPricesRepository.AddRange(DbInitializer.getMealPlanPrices());
            }

            #endregion
        }