public async Task <IActionResult> Edit(int id, [Bind("DaysAmount,MonthsAmount,YearsAmount,Id")] DepositTerm depositTerm) { if (id != depositTerm.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(depositTerm); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepositTermExists(depositTerm.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(depositTerm)); }
public async Task <IActionResult> Edit(int id, [Bind("PassportId,AddressId,PhoneNumberId,Email,Id")] Depositor depositor) { if (id != depositor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(depositor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepositorExists(depositor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewBag.Addresses = _context.Addresses.Include(s => s.Street).Select(s => new SelectListItem($"{s.Street.Locality.LocalityName} {s.Street.StreetName} {s.House} {s.Housing}", s.Id.ToString())); ViewBag.Passports = _context.Passports.Select(s => new SelectListItem(s.FullName, s.Id.ToString())); ViewBag.PhoneNumbers = _context.PhoneNumbers.Include(s => s.Operator).Select(s => new SelectListItem($"{s.Operator.Operator} {s.OperatorCode} {s.Number}", s.Id.ToString())); return(View(depositor)); }
public async Task <IActionResult> Edit(int id, [Bind("OpeningDate,ClosingDate,Amount,Currency,Id")] Account account) { if (id != account.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(account); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccountExists(account.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewBag.Currencies = CurrencyConsts.Dict.Select(s => new SelectListItem(s.Value, s.Key.ToString())); return(View(account)); }
public async Task <IActionResult> Edit(int id, [Bind("LocalityId,StreetName,Postcode,Id")] Street street) { if (id != street.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(street); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StreetExists(street.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LocalityId"] = new SelectList(_context.Localities, "Id", "LocalityName", street.LocalityId); return(View(street)); }
public async Task <IActionResult> Edit(int id, [Bind("Operator,Id")] PhoneNumberOperator phoneNumberOperator) { if (id != phoneNumberOperator.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(phoneNumberOperator); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhoneNumberOperatorExists(phoneNumberOperator.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(phoneNumberOperator)); }
public async Task <IActionResult> Edit(int id, [Bind("Name,Id")] IssuingAuthority issuingAuthority) { if (id != issuingAuthority.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(issuingAuthority); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IssuingAuthorityExists(issuingAuthority.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(issuingAuthority)); }
public async Task <IActionResult> Edit(Currency id, [Bind("Currency,Buy,AmountInNativeCurrencyPerUnit")] CurrencyConversion currencyConversion) { if (id != currencyConversion.Currency) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(currencyConversion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CurrencyConversionExists(currencyConversion.Currency)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(currencyConversion)); }
public async Task <IActionResult> Edit(int id, [Bind("DepositId,DepositorId,EmployeeId,AccountId,ConclusionDate,TerminationDate,Id")] Contract contract) { if (id != contract.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contract); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContractExists(contract.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AccountId"] = new SelectList(_context.Accounts, "Id", "Id", contract.AccountId); ViewData["DepositId"] = new SelectList(_context.Deposits, "Id", "DepositName", contract.DepositId); ViewData["DepositorId"] = new SelectList(_context.Depositors, "Id", "Id", contract.DepositorId); ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "Password", contract.EmployeeId); return(View(contract)); }
public async Task <IActionResult> Edit(int id, [Bind("Region,LocalityName,LocalityType,Id")] Locality locality) { if (id != locality.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(locality); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocalityExists(locality.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(locality)); }
public async Task <IActionResult> Edit(int id, [Bind("StreetId,House,Housing,Apartment,Id")] 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["StreetId"] = new SelectList(_context.Streets, "Id", "StreetName", address.StreetId); return(View(address)); }
public async Task <IActionResult> Edit(int id, [Bind("FirstName,MiddleName,LastName,BirthDate,Gender,CitizenshipId,Number,IdentificationNumber,IssuingAuthorityId,IssuingAuthorityLocalityId,IssueDate,ExpirationDate,Citizenship,Id")] Passport passport) { if (id != passport.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(passport); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PassportExists(passport.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } var localities = await localityRepository.GetBy().ToListAsync(); ViewBag.Localities = localities.Select(a => new SelectListItem($"{a.Region} {a.LocalityName}", a.Id.ToString())); var firstLocality = localities.FirstOrDefault(); if (firstLocality != null) { var issuingAuthorityLocalities = await issuingAuthorityLocalityRepository.GetBy(a => a.LocalityId == firstLocality.Id, a => a.IssuingAuthority).ToListAsync(); ViewBag.IssuingAuthorities = issuingAuthorityLocalities .Select(a => new SelectListItem(a.IssuingAuthority.Name, a.IssuingAuthority.Id.ToString())); } ViewBag.Citizenships = CitizenshipConsts.Dict.Select(c => new SelectListItem(c.Value, c.Key.ToString())); return(View(passport)); }