public async Task <IActionResult> Edit(int id, [Bind("Id,HotelName,Address,Booking_id,Guest_No,StartDate,EndDate,Room_No")] HotelBoeking hotelBoeking)
        {
            if (id != hotelBoeking.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hotelBoeking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HotelBoekingExists(hotelBoeking.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hotelBoeking));
        }
Exemplo n.º 2
0
        public IActionResult Edit(HotelBoeking h)
        {
            _context.HotelBoekingen.Attach(h);
            var boeking = _context.Entry(h);

            boeking.State = EntityState.Modified;
            _context.SaveChanges();
            return(RedirectToAction("Wijzigen", h));
        }
        public async Task <IActionResult> Create([Bind("Id,HotelName,Address,Booking_id,Guest_No,StartDate,EndDate,Room_No")] HotelBoeking hotelBoeking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hotelBoeking);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hotelBoeking));
        }
Exemplo n.º 4
0
        public IActionResult EditBoeking(int id)
        {
            HotelBoeking hotel = null;

            foreach (HotelBoeking getHotel in HotelBoeking.AllBoeking)
            {
                if (getHotel.BoekingID == id)
                {
                    hotel = getHotel;
                }
            }

            return(View(hotel));
        }
Exemplo n.º 5
0
        public IActionResult AddBoeking(string name, double price, DateTime date)
        {
            HotelBoeking boeking = new HotelBoeking()
            {
                Name  = name,
                Price = price,
                Date  = date
            };

            HotelBoeking.AllBoeking.Add(boeking);

            TempData["status"] = "Boeking " + boeking.Name + " is toegevoegd.";
            return(RedirectToAction("index"));
        }
Exemplo n.º 6
0
 public IActionResult Create(HotelBoeking h)
 {
     _context.HotelBoekingen.Add(h);
     _context.SaveChanges();
     return(RedirectToAction("Verwerken", h));
 }
Exemplo n.º 7
0
        public IActionResult Edit(int id)
        {
            HotelBoeking h = _context.HotelBoekingen.Where(b => b.HotelBoekingId == id).First();

            return(View(h));
        }
Exemplo n.º 8
0
 public IActionResult Wijzigen(HotelBoeking h)
 {
     return(View(h));
 }
Exemplo n.º 9
0
 public IActionResult Verwerken(HotelBoeking h)
 {
     return(View(h));
 }