public async Task <IActionResult> Edit(long id, [Bind] Apartment apartments) { if (id != apartments.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(apartments); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApartmentsExists(apartments.Id)) { return(NotFound()); } throw; } return(RedirectToAction("Index")); } return(View(apartments)); }
public async Task <IActionResult> Edit(long id, [Bind] Customer customer) { if (id != customer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind] Building building) { if (id != building.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(building); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BuildingExists(building.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["CustomerId"] = new SelectList(_context.Set <Customer>(), "Id", "Id", building.CustomerId); return(View(building)); }
public async Task <IActionResult> Edit(long id, [Bind] 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("Index")); } ViewBag.builingData = _context.Buildings.Include(building => building.Apartments).ToList(); ViewData["CustomerId"] = new SelectList(_context.Customers, "id", "id", contract.CustomerId); return(View(contract)); }