public async Task <IActionResult> Edit(int id, [Bind("BusinessEntityId,Name,SalesPersonId,Demographics,Rowguid,ModifiedDate")] Store store) { if (id != store.BusinessEntityId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(store); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreExists(store.BusinessEntityId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BusinessEntityId"] = new SelectList(_context.BusinessEntity, "BusinessEntityId", "BusinessEntityId", store.BusinessEntityId); ViewData["SalesPersonId"] = new SelectList(_context.SalesPerson, "BusinessEntityId", "BusinessEntityId", store.SalesPersonId); return(View(store)); }
public async Task <IActionResult> Edit(int id, [Bind("BusinessEntityId,TerritoryId,SalesQuota,Bonus,CommissionPct,SalesYtd,SalesLastYear,Rowguid,ModifiedDate")] SalesPerson salesPerson) { if (id != salesPerson.BusinessEntityId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(salesPerson); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalesPersonExists(salesPerson.BusinessEntityId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BusinessEntityId"] = new SelectList(_context.Employee, "BusinessEntityId", "Gender", salesPerson.BusinessEntityId); ViewData["TerritoryId"] = new SelectList(_context.SalesTerritory, "TerritoryId", "CountryRegionCode", salesPerson.TerritoryId); return(View(salesPerson)); }
public async Task <IActionResult> Edit(int id, [Bind("BusinessEntityId,Rowguid,ModifiedDate")] BusinessEntity businessEntity) { if (id != businessEntity.BusinessEntityId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(businessEntity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BusinessEntityExists(businessEntity.BusinessEntityId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(businessEntity)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,PersonId,StoreId,TerritoryId,AccountNumber,Rowguid,ModifiedDate")] Customer customer) { if (id != customer.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(_context.Person, "BusinessEntityId", "FirstName", customer.PersonId); ViewData["StoreId"] = new SelectList(_context.Store, "BusinessEntityId", "Name", customer.StoreId); ViewData["TerritoryId"] = new SelectList(_context.SalesTerritory, "TerritoryId", "CountryRegionCode", customer.TerritoryId); return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("BusinessEntityId,PersonType,NameStyle,Title,FirstName,MiddleName,LastName,Suffix,EmailPromotion,AdditionalContactInfo,Demographics,Rowguid,ModifiedDate")] Person person) { if (id != person.BusinessEntityId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(person); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(person.BusinessEntityId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BusinessEntityId"] = new SelectList(_context.BusinessEntity, "BusinessEntityId", "BusinessEntityId", person.BusinessEntityId); return(View(person)); }