public async Task <IActionResult> Edit(int id, [Bind("ID,AccomodationPackageID,FromDate,Duration,NoOfAdults,NoOfChildren,Name,Email,Notes")] Booking booking)
        {
            if (id != booking.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookingExists(booking.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccomodationPackageID"] = new SelectList(_context.AccomodationPackages, "ID", "Name", booking.AccomodationPackageID);
            return(View(booking));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Description")] AccomodationType accomodationType)
        {
            if (id != accomodationType.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accomodationType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccomodationTypeExists(accomodationType.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(accomodationType));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("LoginId,Username,Password,Usertype")] Login login)
        {
            if (id != login.LoginId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(login);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoginExists(login.LoginId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(login));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,AccomodationPackageID,Name,Description")] Accomodation accomodation)
        {
            if (id != accomodation.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accomodation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccomodationExists(accomodation.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccomodationPackageID"] = new SelectList(_context.AccomodationPackages, "ID", "Name", accomodation.AccomodationPackageID);
            return(View(accomodation));
        }
        public async Task <IActionResult> Edit(int?id, MiscellaneousBilling miscellaneousbilling)
        {
            if (miscellaneousbilling.VisitorId == 0)
            {
                var visitors = _dbContext.Visitor.ToList();
                visitors.Insert(0, new Visitor {
                    VisitorId = 0, VisitorName = "Select"
                });
                ViewBag.Visitors = visitors;
                ModelState.AddModelError("VisitorId", "Please select the Visitor Name");
                return(View(miscellaneousbilling));
            }
            if (ModelState.IsValid)
            {
                if (id == null)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    _dbContext.Update(miscellaneousbilling);
                    await _dbContext.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            return(View(miscellaneousbilling));
        }
        public async Task <IActionResult> Edit(int?id, Visitor visitor)
        {
            if (ModelState.IsValid)
            {
                if (id == null)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    _dbContext.Update(visitor);
                    await _dbContext.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            return(View(visitor));
        }