//DETAILS public IActionResult Details(int id) { HotelType hoteltype = context.HotelTypes. Where(x => x.HotelTypeId == id).SingleOrDefault(); return(View(hoteltype)); }
public HotelSeedMetada(string name, int rating, HotelType type, int year) { HotelType = type; Prefix = name; Rating = rating; Year = year; }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Template")] HotelType hotelType) { if (id != hotelType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(hotelType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HotelTypeExists(hotelType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(hotelType)); }
public IEnumerable <HotelService> GetHotelServicesByHotelType(HotelType type) { switch (type) { case HotelType.Platinum: case HotelType.Gold: return(GetAllHotelServices()); case HotelType.Spa: return(_commonServices.Concat(_spaServices)); case HotelType.Business: return(_commonServices.Concat(_businessServices)); case HotelType.Family: return(_commonServices.Concat(_familyServices)); case HotelType.Ressort: return(_commonServices.Concat(_spaServices).Concat(_luxuryServices)); case HotelType.Economy: return(_commonServices); default: return(_commonServices); } }
public async Task <ActionResult <IEnumerable <HotelType> > > Post([FromBody] HotelType hotelType) { context.HotelTypes.Add(hotelType); await context.SaveChangesAsync(); return(CreatedAtAction(nameof(Get), new { id = hotelType.HotelTypeId }, hotelType)); }
/// <summary> /// Process the player entry /// </summary> public override void ProcessPlayerEntry() { if (Owner == null) { Owner = Player; HotelType = HotelType.Silver; int buyOrSellAmount = Helper.HotelTypeUpgradeValue[HotelType]; Owner.Debit(buyOrSellAmount); Bank.Credit(buyOrSellAmount); Owner.AssetBalance += buyOrSellAmount; } else if (Owner != null) { if (Owner.Id == Player.Id) { if (HotelType == HotelType.Silver) { HotelType = HotelType.Gold; } else if (HotelType == HotelType.Gold) { HotelType = HotelType.Platinum; } int buyOrSellAmount = Helper.HotelTypeUpgradeValue[HotelType]; Owner.Debit(buyOrSellAmount); Bank.Credit(buyOrSellAmount); Owner.AssetBalance += buyOrSellAmount; } else { Owner.Credit(Helper.HotelTypeRent[HotelType]); Player.Debit(Helper.HotelTypeRent[HotelType]); } } }
public ActionResult Edit(int id) { HotelType ud = context.HotelTypes.Where(x => x.HotelTypeId == id).SingleOrDefault(); //ViewBag.hotelType = new SelectList(context.Hotels, "HotelId", "HotelName",ud.Hotels); return(View(ud)); }
public double BuildTrip(string fromCity, string toCity, int days, HotelType hotelType, TripType tripType, GuideType guideType) { double price = 0; var hotelBooking = new HotelBooking(); price += hotelBooking.BookHotel(hotelType, days); var tripBooking = new TripBooking(); price += tripBooking.BookTrip(tripType, fromCity, toCity); var guideBooking = new GuideBooking(); price += guideBooking.BookGuide(guideType, days); //Console.WriteLine("Tour info:"); //Console.WriteLine($"From: {fromCity}"); //Console.WriteLine($"To: {toCity}"); //Console.WriteLine($"Hotel type: {hotelType}"); //Console.WriteLine($"Trip type: {tripType}"); //Console.WriteLine($"Guide type: {guideType}"); //Console.WriteLine($"Total price: {price}"); return(price); }
/// <summary> /// Finds best hotel according to rating /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="customerType"></param> /// <returns>HotelType enum</returns> public HotelType FindBestRatedHotel(string startDate, string endDate, CustomerType customerType) { HotelType hotelType = HotelType.LAKEWOOD; Hotel lakewood = new Hotel(hotelType, customerType); double rateLakewood = lakewood.FindRate(startDate, endDate); hotelType = HotelType.BRIDGEWOOD; Hotel bridgewood = new Hotel(hotelType, customerType); double rateBridgewood = bridgewood.FindRate(startDate, endDate); hotelType = HotelType.RIDGEWOOD; Hotel ridgewood = new Hotel(hotelType, customerType); double rateRidgewood = ridgewood.FindRate(startDate, endDate); if (lakewood.RATING > bridgewood.RATING && lakewood.RATING > ridgewood.RATING) { hotelType = HotelType.LAKEWOOD; Console.WriteLine("Best hotel for your stay is " + HotelType.LAKEWOOD + ", Rating: " + lakewood.RATING + ", Cost of stay: " + rateLakewood); } if (bridgewood.RATING > lakewood.RATING && bridgewood.RATING > ridgewood.RATING) { hotelType = HotelType.BRIDGEWOOD; Console.WriteLine("Best hotel for your stay is " + HotelType.BRIDGEWOOD + ", Rating: " + bridgewood.RATING + ", Cost of stay: " + rateBridgewood); } if (ridgewood.RATING > lakewood.RATING && ridgewood.RATING > bridgewood.RATING) { hotelType = HotelType.RIDGEWOOD; Console.WriteLine("Best hotel for your stay is " + HotelType.RIDGEWOOD + ", Rating: " + ridgewood.RATING + ", Cost of stay: " + rateRidgewood); } return(hotelType); }
public HotelType AddHotelType(int vHotelTypeID, string vName, string vImageUrl, DateTime vAddedDate, string vAddedBy, DateTime vUpdatedDate, string vUpdatedBy, bool vActive) { HotelType lHotelType = new HotelType(); using (FRShoppingEntities frctx = new FRShoppingEntities()) { if (vHotelTypeID > 0) { lHotelType = frctx.HotelTypes.FirstOrDefault(u => u.HotelTypeId == vHotelTypeID); lHotelType.Name = vName; lHotelType.ImageUrl = vImageUrl; lHotelType.UpdatedDate = vUpdatedDate; lHotelType.UpdatedBy = vUpdatedBy; lHotelType.Active = vActive; return(frctx.SaveChanges() > 0 ? lHotelType : null); } else { lHotelType.Name = vName; lHotelType.ImageUrl = vImageUrl; lHotelType.AddedDate = vAddedDate; lHotelType.AddedBy = vAddedBy; lHotelType.UpdatedDate = vUpdatedDate; lHotelType.UpdatedBy = vUpdatedBy; lHotelType.Active = vActive; return(AddHotelType(lHotelType)); } } }
public ActionResult DeleteConfirmed(int id) { HotelType hoteltype = db.HotelTypes.Single(h => h.id == id); db.HotelTypes.DeleteObject(hoteltype); db.SaveChanges(); return(RedirectToAction("Index")); }
public void FindCheapestHotelTest() { HotelService service = new HotelService(); HotelType hotel = service.FindCheapestHotel("2018-01-01", "2018-01-03"); HotelType expected = HotelType.LAKEWOOD; Assert.AreEqual(hotel, expected); }
public void CheapestBestRatedHotelForRewardCustomer_ShouldReturnRidgeWood() { HotelService service = new HotelService(); HotelType hotel = service.FindCheapestHotel("2020-09-11", "2020-09-12", CustomerType.REWARD); HotelType expected = HotelType.RIDGEWOOD; Assert.AreEqual(hotel, expected); }
public ActionResult Delete(int id, HotelType e1) { var hotelType = context.HotelTypes.Where(x => x.HotelTypeId == id).SingleOrDefault(); context.HotelTypes.Remove(hotelType); context.SaveChanges(); return(RedirectToAction("Index")); }
public void CheapestBestRatedHotelForRegularCustomer_ShouldReturnBridgeWood() { HotelService service = new HotelService(); HotelType type = service.FindCheapestHotel("2020-09-11", "2020-09-12", CustomerType.NORMAL); HotelType expected = HotelType.BRIDGEWOOD; Assert.AreEqual(type, expected); }
public void BestRatedHotel() { HotelReservationClass service = new HotelReservationClass(); HotelType hotel = service.FindBestRatedHotel("2020-09-08", "2020-09-09", CustomerType.NORMAL); HotelType expected = HotelType.RIDGEWOOD; Assert.AreEqual(hotel, expected); }
public void BestRatedHotelForRewardCustomers() { HotelReservationClass service = new HotelReservationClass(); HotelType hotel = service.FindCheapestBestRatedHotel("2020-09-11", "2020-09-12", CustomerType.REWARD); HotelType expected = HotelType.RIDGEWOOD; Assert.AreEqual(hotel, expected); }
public void FindCheapestWeekdaysRate() { HotelReservationClass service = new HotelReservationClass(); HotelType hotel = service.FindCheapestHotel("2020-09-08", "2020-09-09", CustomerType.NORMAL); HotelType expected = HotelType.LAKEWOOD; Assert.AreEqual(hotel, expected); }
public static HotelConfig GetHotel(HotelType hotelType) { if (!Hotels.ContainsKey(hotelType)) { throw new ApplicationException($"Hotel {hotelType} does not exist in the HotelManager."); } return(Hotels[hotelType]); }
public ActionResult Edit(HotelType ht1) { HotelType hoteltype = context.HotelTypes.Where(x => x.HotelTypeId == ht1.HotelTypeId).SingleOrDefault(); hoteltype.HotelTypeId = ht1.HotelTypeId; hoteltype.HotelTypeName = ht1.HotelTypeName; hoteltype.HotelTypeDescription = ht1.HotelTypeDescription; context.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Create([Bind("HotelTypeName", "HotelTypeDescription")] HotelType ht1) { if (ModelState.IsValid) { context.HotelTypes.Add(ht1); context.SaveChanges(); return(RedirectToAction("Index")); } return(View(ht1)); }
private bool ChangeLockState(HotelType vHotelType, bool vState) { using (FRShoppingEntities frenty = new FRShoppingEntities()) { HotelType up = frenty.HotelTypes.FirstOrDefault(e => e.HotelTypeId == vHotelType.HotelTypeId); up.UpdatedDate = DateTime.Now; up.Active = vState; return(frenty.SaveChanges() > 0 ? true : false); } }
public ActionResult Edit(int id, HotelType e1) { HotelType hotelType = context.HotelTypes.Where(x => x.HotelTypeId == id).SingleOrDefault(); hotelType.HotelTypeName = e1.HotelTypeName; hotelType.HotelTypeDescription = e1.HotelTypeDescription; //context.Entry(hotelType).CurrentValues.SetValues(e1); context.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Detail(int id) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:61076"); HttpResponseMessage response = client.GetAsync("/api/HotelType/" + id).Result; string stringdata = response.Content.ReadAsStringAsync().Result; HotelType data = JsonConvert.DeserializeObject <HotelType>(stringdata); return(View(data)); }
private void AddHotel(Player player, string playerName, HotelType hotelType) { player.HotelsOwned.Add(new Hotel { Type = hotelType, OwnedBy = playerName, Rent = GetHotelRent(hotelType), RentedTo = string.Empty, Value = GetHotelValue(hotelType) }); }
public ActionResult Create(HotelType hoteltype) { if (ModelState.IsValid) { db.HotelTypes.AddObject(hoteltype); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hoteltype)); }
public async Task <IActionResult> Create([Bind("Id,Name,Template")] HotelType hotelType) { if (ModelState.IsValid) { _context.Add(hotelType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hotelType)); }
public ActionResult Edit(HotelType hoteltype) { if (ModelState.IsValid) { db.HotelTypes.Attach(hoteltype); db.ObjectStateManager.ChangeObjectState(hoteltype, EntityState.Modified); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hoteltype)); }
public ActionResult Delete(int id, HotelType hotelType) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:61076"); string stringData = JsonConvert.SerializeObject(hotelType); HttpResponseMessage response = client.DeleteAsync("/api/HotelType/" + id).Result; ViewBag.Message = response.Content.ReadAsStringAsync().Result; return(RedirectToAction("Index")); }
public ActionResult Edit(HotelType hotelType) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:61076"); string stringData = JsonConvert.SerializeObject(hotelType); var contentData = new StringContent(stringData, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PutAsync("/api/HotelType/" + hotelType.HotelTypeId, contentData).Result; ViewBag.Message = response.Content.ReadAsStringAsync().Result; return(RedirectToAction("Index")); }