public async Task <IActionResult> Edit(int id, [Bind("Id,City1")] City city) { if (id != city.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(city); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CityExists(city.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(city)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ElectionId,CityId,CandidateId")] Bulletin bulletin) { if (id != bulletin.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bulletin); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BulletinExists(bulletin.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CandidateId"] = new SelectList(_context.Candidate, "Id", "PreelectionProgram", bulletin.CandidateId); ViewData["CityId"] = new SelectList(_context.City, "Id", "City1", bulletin.CityId); ViewData["ElectionId"] = new SelectList(_context.Election, "Id", "Id", bulletin.ElectionId); return(View(bulletin)); }
public async Task <IActionResult> Edit(int id, [Bind("UserID,Name,Email,Password")] Person user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,BirthDate,AddressId,CountryId")] Person person) { if (id != person.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(person); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(person.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AddressId"] = new SelectList(_context.Address, "Id", "Id", person.AddressId); ViewData["CountryId"] = new SelectList(_context.Nation, "Id", "Country", person.CountryId); return(View(person)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,RegionId,CityId,StreetId")] Address address) { if (id != address.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(address); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddressExists(address.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "Id", "City1", address.CityId); ViewData["RegionId"] = new SelectList(_context.Region, "Id", "Region1", address.RegionId); ViewData["StreetId"] = new SelectList(_context.Street, "Id", "Street1", address.StreetId); return(View(address)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ElectionId,CityId,VoterId")] ControlCoupon controlCoupon) { if (id != controlCoupon.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(controlCoupon); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ControlCouponExists(controlCoupon.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "Id", "City1", controlCoupon.CityId); ViewData["ElectionId"] = new SelectList(_context.Election, "Id", "Id", controlCoupon.ElectionId); ViewData["VoterId"] = new SelectList(_context.Voter, "Id", "Id", controlCoupon.VoterId); return(View(controlCoupon)); }
public async Task<IActionResult> Edit(int id, [Bind("Id,PersonId")] Admin admin) { if (id != admin.Id) { return NotFound(); } if (ModelState.IsValid) { try { _context.Update(admin); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdminExists(admin.Id)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } ViewData["PersonId"] = new SelectList(_context.Person, "Id", "Name", admin.PersonId); return View(admin); }
public async Task <IActionResult> Edit(int id, [Bind("Id,PersonId,ElectionId,PreelectionProgram")] Candidate candidate) { if (id != candidate.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(candidate); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CandidateExists(candidate.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ElectionId"] = new SelectList(_context.Election, "Id", "Id", candidate.ElectionId); ViewData["PersonId"] = new SelectList(_context.Person, "Id", "Name", candidate.PersonId); return(View(candidate)); }
public async Task <IActionResult> Edit(int id, [Bind("DatetimeStart,DatetimeEnd,Id")] Period period) { if (id != period.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(period); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PeriodExists(period.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(period)); }