Exemple #1
0
 public BaseCard(decimal price, CountriesEnum country, HotelTypes hotelClass, FoodTypes food)
 {
     Price      = price;
     Country    = country;
     HotelClass = hotelClass;
     Food       = food;
 }
Exemple #2
0
        public async Task <IActionResult> PutHotelTypes([FromRoute] int id, [FromBody] HotelTypes hotelTypes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hotelTypes.HotelTypeId)
            {
                return(BadRequest());
            }

            _context.Entry(hotelTypes).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HotelTypesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        private void UpgradeHotel(HotelTypes newHotel)
        {
            switch (newHotel)
            {
            case HotelTypes.Silver:
                TotalAssets = 200;
                Amount     -= 200;
                HotelType   = HotelTypes.Silver;
                break;

            case HotelTypes.Gold:
                TotalAssets = 300;
                Amount     -= 100;
                HotelType   = HotelTypes.Gold;
                break;

            case HotelTypes.Platinum:
                TotalAssets = 500;
                Amount     -= 200;
                HotelType   = HotelTypes.Platinum;
                break;

            case HotelTypes.None:
            default:
                break;
            }
        }
Exemple #4
0
        public void CheapestBestRatedHotelForRewardCustomerTest()
        {
            HotelService service  = new HotelService();
            HotelTypes   hotel    = service.FindCheapestHotel("2020-09-11", "2020-09-12", CustomerType.REWARD);
            HotelTypes   expected = HotelTypes.RIDGEWOOD;

            Assert.AreEqual(hotel, expected);
        }
Exemple #5
0
 public Excursion(decimal price, CountriesEnum country, HotelTypes hotelClass, FoodTypes food)
     : base(price, country, hotelClass, food)
 {
     Price      = price;
     Country    = country;
     HotelClass = hotelClass;
     Food       = food;
 }
Exemple #6
0
 public static HotelTypeModel ToHotelTypeModel(this HotelTypes hotelType)
 {
     return(new HotelTypeModel
     {
         HotelType = hotelType.HotelType.Trim(),
         RoomTypeName = hotelType.RoomTypeName.Trim(),
         RoomTypeShortName = hotelType.RoomTypeShortName.Trim(),
         RoomTypeShortNamePlural = hotelType.RoomTypeShortNamePlural.Trim(),
         HotelTypeName = hotelType.HotelTypeName.Trim()
     });
 }
Exemple #7
0
        public ViewResult Details(int id)
        {
            Hotels hotels = context.Hotels.Where(x => x.HotelId == id).SingleOrDefault();

            ViewBag.Hotel = hotels;
            int        htid       = ViewBag.Hotel.HotelTypeId;
            HotelTypes hoteltypes = context.HotelTypes.Where(x => x.HotelTypeId == htid).SingleOrDefault();

            ViewBag.HotelType = hoteltypes;
            return(View());
        }
        public IActionResult Details(int id)
        {
            Hotels hotel = _context.Hotels.Where(x => x.HotelId == id).SingleOrDefault();

            ViewBag.Hotel = hotel;

            int        hotelTypeId = ViewBag.Hotel.HotelTypeId;
            HotelTypes hotelTypes  = _context.HotelTypes.Where(x => x.HotelTypeId == hotelTypeId).SingleOrDefault();

            ViewBag.HotelType = hotelTypes;
            return(View());
        }
Exemple #9
0
        public async Task <IActionResult> PostHotelTypes([FromBody] HotelTypes hotelTypes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.HotelTypes.Add(hotelTypes);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHotelTypes", new { id = hotelTypes.HotelTypeId }, hotelTypes));
        }
        public void GetRent(HotelTypes hotelType)
        {
            switch (hotelType)
            {
            case HotelTypes.Silver:
                this.Amount += 50;
                break;

            case HotelTypes.Gold:
                this.Amount += 150;
                break;

            case HotelTypes.Platinum:
                this.Amount += 300;
                break;

            case HotelTypes.None:
            default:
                break;
            }
        }
Exemple #11
0
 public Shopping(decimal price, CountriesEnum country, HotelTypes hotelClass, FoodTypes food)
     : base(price, country, hotelClass, food)
 {
 }
Exemple #12
0
 public Hotel(HotelTypes hotelType, CustomerType customerType)
 {
     this.type = hotelType;
     try
     {
         if (hotelType.Equals(HotelTypes.LAKEWOOD))
         {
             this.RATING = 3;
             try
             {
                 if (customerType.Equals(CustomerType.NORMAL))
                 {
                     this.WEEKDAY_RATE = 110;
                     this.WEEKEND_RATE = 90;
                 }
                 if (customerType.Equals(CustomerType.REWARD))
                 {
                     this.WEEKDAY_RATE = 80;
                     this.WEEKEND_RATE = 80;
                 }
             }
             catch (HotelReservationSystemException)
             {
                 throw new HotelReservationSystemException(HotelReservationSystemException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
         if (hotelType.Equals(HotelTypes.BRIDGEWOOD))
         {
             this.RATING = 4;
             try
             {
                 if (customerType.Equals(CustomerType.NORMAL))
                 {
                     this.WEEKDAY_RATE = 150;
                     this.WEEKEND_RATE = 50;
                 }
                 if (customerType.Equals(CustomerType.REWARD))
                 {
                     this.WEEKDAY_RATE = 110;
                     this.WEEKEND_RATE = 50;
                 }
             }
             catch (HotelReservationSystemException)
             {
                 throw new HotelReservationSystemException(HotelReservationSystemException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
         if (hotelType.Equals(HotelTypes.RIDGEWOOD))
         {
             this.RATING = 5;
             try
             {
                 if (customerType.Equals(CustomerType.NORMAL))
                 {
                     this.WEEKDAY_RATE = 220;
                     this.WEEKEND_RATE = 150;
                 }
                 if (customerType.Equals(CustomerType.REWARD))
                 {
                     this.WEEKDAY_RATE = 100;
                     this.WEEKEND_RATE = 40;
                 }
             }
             catch (Exception)
             {
                 throw new HotelReservationSystemException(HotelReservationSystemException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
     }
     catch (HotelReservationSystemException)
     {
         throw new HotelReservationSystemException(HotelReservationSystemException.ExceptionType.INVALID_HOTEL_TYPE, "Invalid Hotel Type");
     }
 }
Exemple #13
0
 public Treatment(decimal price, CountriesEnum country, HotelTypes hotelClass, FoodTypes food)
     : base(price, country, hotelClass, food)
 {
 }