コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("MovieComingSoonId,ImageUrl,LongDescription,ShortDescription,Title")] MovieComingSoon movieComingSoon)
        {
            if (id != movieComingSoon.MovieComingSoonId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movieComingSoon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieComingSoonExists(movieComingSoon.MovieComingSoonId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(movieComingSoon));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("MovieComingSoonId,ImageUrl,LongDescription,ShortDescription,Title")] MovieComingSoon movieComingSoon)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movieComingSoon);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(movieComingSoon));
        }