示例#1
0
      public async Task <IActionResult> Edit(int id, [Bind("MountainId,MountainName,Elevation,Difficulty")] Mountain mountain)
      {
          if (id != mountain.MountainId)
          {
              return(NotFound());
          }

          if (ModelState.IsValid)
          {
              try
              {
                  _context.Update(mountain);
                  await _context.SaveChangesAsync();
              }
              catch (DbUpdateConcurrencyException)
              {
                  if (!MountainExists(mountain.MountainId))
                  {
                      return(NotFound());
                  }
                  else
                  {
                      throw;
                  }
              }
              return(RedirectToAction(nameof(Index)));
          }
          return(View(mountain));
      }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("CineplexId,ImageUrl,Location,LongDescription,ShortDescription")] Cineplex cineplex)
        {
            if (id != cineplex.CineplexId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cineplex);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CineplexExists(cineplex.CineplexId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(cineplex));
        }
示例#3
0
        public async Task <IActionResult> Edit(string id, [Bind("Title,CompanyId,AgeRestriction,Price,CustomerName")] Games games)
        {
            if (id != games.Title)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(games);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GamesExists(games.Title))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(games));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("CineplexId,MovieId,SessionId")] CineplexMovie cineplexMovie)
        {
            if (id != cineplexMovie.CineplexId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cineplexMovie);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CineplexMovieExists(cineplexMovie.CineplexId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CineplexId"] = new SelectList(_context.Cineplex, "CineplexId", "Location", cineplexMovie.CineplexId);
            ViewData["MovieId"]    = new SelectList(_context.Movie, "MovieId", "LongDescription", cineplexMovie.MovieId);
            ViewData["SessionId"]  = new SelectList(_context.SessionTime, "SessionTimeId", "SessionTimeId", cineplexMovie.SessionId);
            return(View(cineplexMovie));
        }
        public async Task <IActionResult> Edit(int id, [Bind("MovieId,ImageUrl,LongDescription,Price,ShortDescription,Title")] Movie movie)
        {
            if (id != movie.MovieId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movie);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieExists(movie.MovieId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(movie));
        }
示例#6
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,Address,City,Province,PostalCode,Age,Password,ConfirmPassword,Email,AlternativeEmail,Phone")] Member member)
        {
            if (id != member.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(member);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MemberExists(member.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(member));
        }
示例#7
0
        public async Task <IActionResult> Edit(string id, [Bind("CustomerName,Title,CompanyId")] Customer customer)
        {
            if (id != customer.CustomerName)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustomerName))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompanyId"] = new SelectList(_context.Company, "CompanyId", "CompanyId", customer.CompanyId);
            ViewData["Title"]     = new SelectList(_context.Games, "Title", "Title", customer.Title);
            return(View(customer));
        }
示例#8
0
        public async Task <IActionResult> Edit(int id, [Bind("SessionTimeId,SessionTime1,SessionTime2")] SessionTime sessionTime)
        {
            if (id != sessionTime.SessionTimeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sessionTime);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SessionTimeExists(sessionTime.SessionTimeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(sessionTime));
        }
示例#9
0
        public async Task <IActionResult> Edit(int id, [Bind("HikeId,MountainName,MountainId,DateHiked,TimeToSummit")] HikeLog hikeLog)
        {
            if (id != hikeLog.HikeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hikeLog);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HikeLogExists(hikeLog.HikeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MountainId"]   = new SelectList(_context.Mountain, "MountainId", "MountainName", hikeLog.MountainId);
            ViewData["MountainName"] = new SelectList(_context.Mountain, "MountainName", "MountainName", hikeLog.MountainName);
            return(View(hikeLog));
        }
示例#10
0
        public async Task <IActionResult> Edit(int id, [Bind("CompanyId,CompanyName,CompanyCeo,CompanyAge")] Company company)
        {
            if (id != company.CompanyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(company);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.CompanyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }