コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Gender,DOB,Bio,MovieFK")] Maker maker)
        {
            if (id != maker.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(maker);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MakerExists(maker.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MovieFK"] = new SelectList(_context.Movie, "ID", "ID", maker.MovieFK);
            return(View(maker));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,MovieName,plot,publishTime,IsHit,ProduceDt")] Movie movie)
        {
            if (id != movie.ID)
            {
                return(NotFound());
            }

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