Exemplo n.º 1
0
        public ActionResult AddArrangement(int id)
        {
            AddArrangementSpecialOffer addArrangement = new AddArrangementSpecialOffer();
            HotelSpecialOffer          hotel          = db.HotelSpecialOffers.Include(h => h.arrangementPrices).Include(h => h.specialOffer).FirstOrDefault(h => h.Id == id);

            addArrangement.hotel = hotel;
            addArrangement.HotelSpecialOfferId = id;
            return(View(addArrangement));
        }
Exemplo n.º 2
0
        public ActionResult AddArrangement(AddArrangementSpecialOffer model)
        {
            HotelSpecialOffer       hotel      = db.HotelSpecialOffers.Find(model.HotelSpecialOfferId);
            ArrangementPriceSpecial terminCena = new ArrangementPriceSpecial();

            terminCena.date  = model.dateTime;
            terminCena.price = model.price;
            terminCena.hotel = hotel;
            terminCena.HotelSpecialOfferId = model.HotelSpecialOfferId;
            db.ArrangementPriceSpecials.Add(terminCena);
            db.SaveChanges();
            var termincenaOdBaza = db.ArrangementPriceSpecials.FirstOrDefault(t => t.date == model.dateTime && t.price == model.price);

            hotel.arrangementPrices.Add(termincenaOdBaza);
            db.SaveChanges();
            return(RedirectToAction("Details", new { id = model.HotelSpecialOfferId }));
        }