public async Task <IActionResult> EditConfirmed(int id, [Bind("Id,Name,LastName,PhoneNumber,email,Salary,socSecNum,ApartmentForeginKey")] Apply apply) { if (id != apply.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(apply); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApplyExists(apply.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApartmentForeginKey"] = new SelectList(_context.Apartment, "Id", "Adress", apply.ApartmentForeginKey); return(View(apply)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Adress,Elevator,NumberOfRooms,Balcony,SquareMeter,Floor,Rent,RegisterTime")] Apartment apartment) { if (id != apartment.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(apartment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApartmentExists(apartment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(apartment)); }