public async Task <IActionResult> Edit(int id, [Bind("SalesmanID,PhoneNumber,Email,FirstName,LastName")] Salesman salesman) { if (id != salesman.SalesmanID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(salesman); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalesmanExists(salesman.SalesmanID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(salesman)); }
public async Task <IActionResult> Edit(int id, [Bind("BusinessID,BusinessName,DistrictID,Adress,ZipCode")] Business business) { if (id != business.BusinessID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(business); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BusinessExists(business.BusinessID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DistrictID"] = new SelectList(_context.Districts, "DistrictID", "DistrictName", business.DistrictID); return(View(business)); }