Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("MovieId,Title,Duration,Description,PublicationYear,CoverImage,PreviousPart,Price,Url")] 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("Edit", new { id = movie.MovieId, save = "success" }));
            }

            //ViewData["PreviousPart"] = new SelectList(_context.Movie, "MovieId", "Title", movie.PreviousPart);
            return(View(movie));
        }
        public async Task <IActionResult> Edit(string id, [Bind("Name,Year,Type,MovieId,PersonId,Result")] MovieAward movieAward)
        {
            if (id != movieAward.Name)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movieAward);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieAwardExists(movieAward.Name))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["Name"]     = new SelectList(_context.AwardType, "Name", "Name", movieAward.Name);
            ViewData["MovieId"]  = new SelectList(_context.Movie, "MovieId", "Title", movieAward.MovieId);
            ViewData["PersonId"] = new SelectList(_context.Person, "PersonId", "Firstname", movieAward.PersonId);
            return(View(movieAward));
        }
Example #3
0
        public async Task <IActionResult> Edit(string id, [Bind("GenreName,Description")] Genre genre)
        {
            if (id != genre.GenreName)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(genre);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GenreExists(genre.GenreName))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(genre));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("PersonId,Lastname,Firstname,Gender")] Person person)
        {
            if (id != person.PersonId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(person);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonExists(person.PersonId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(person));
        }