public async Task <IActionResult> Edit(int id, [Bind("PartyId,Name,Logo")] Party party)
        {
            if (id != party.PartyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(party);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PartyExists(party.PartyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(party));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("CandidateId,FirstName,LastName,PartyId,RidingId")] Candidate candidate)
        {
            if (id != candidate.CandidateId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(candidate);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CandidateExists(candidate.CandidateId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PartyId"]  = new SelectList(_context.Party, "PartyId", "Name", candidate.PartyId);
            ViewData["RidingId"] = new SelectList(_context.Riding, "RidingId", "Name", candidate.RidingId);
            return(View(candidate));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("MovieId,Title,Year,Revenue,StudioId,Poster")] 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(nameof(Index)));
            }
            ViewData["StudioId"] = new SelectList(_context.Studio, "StudioId", "Name", movie.StudioId);
            return(View(movie));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ElectionId,Year,PartyId,Majority")] Election election)
        {
            if (id != election.ElectionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(election);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ElectionExists(election.ElectionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PartyId"] = new SelectList(_context.Party, "PartyId", "Name", election.PartyId);
            return(View(election));
        }
        public async Task <IActionResult> Edit(int id, [Bind("RidingId,Name")] Riding riding)
        {
            if (id != riding.RidingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(riding);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RidingExists(riding.RidingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(riding));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("StudioId,Name")] Studio studio)
        {
            if (id != studio.StudioId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(studio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudioExists(studio.StudioId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(studio));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DestinationId,Name,Location,Description,Photo,RegionId")] Destination destination)
        {
            if (id != destination.DestinationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(destination);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DestinationExists(destination.DestinationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RegionId"] = new SelectList(_context.Region, "RegionId", "Name", destination.RegionId);
            return(View(destination));
        }