public async Task <IActionResult> Edit(int id, [Bind("CustomerId,CustomerName,BillToCustomerId,CustomerCategoryId,BuyingGroupId,PrimaryContactPersonId,AlternateContactPersonId,DeliveryMethodId,DeliveryCityId,PostalCityId,CreditLimit,AccountOpenedDate,StandardDiscountPercentage,IsStatementSent,IsOnCreditHold,PaymentDays,PhoneNumber,FaxNumber,DeliveryRun,RunPosition,WebsiteURL,DeliveryAddressLine1,DeliveryAddressLine2,DeliveryPostalCode,DeliveryLocation,PostalAddressLine1,PostalAddressLine2,PostalPostalCode,LastEditedBy,ValidFrom,ValidTo")] Customers customers) { if (id != customers.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomersExists(customers.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AlternateContactPersonId"] = new SelectList(_context.People, "PersonId", "FullName", customers.AlternateContactPersonId); ViewData["CustomerCategoryId"] = new SelectList(_context.CustomerCategories, "CustomerCategoryId", "CustomerCategoryName", customers.CustomerCategoryId); ViewData["DeliveryCityId"] = new SelectList(_context.Cities, "CityId", "CityName", customers.DeliveryCityId); ViewData["PostalCityId"] = new SelectList(_context.Cities, "CityId", "CityName", customers.PostalCityId); ViewData["PrimaryContactPersonId"] = new SelectList(_context.People, "PersonId", "FullName", customers.PrimaryContactPersonId); return(View(customers)); }
public async Task <IActionResult> Edit(int id, [Bind("PersonId,FullName,PreferredName,IsPermittedToLogon,LogonName,IsExternalLogonProvider,HashedPassword,IsSystemUser,IsEmployee,IsSalesperson,UserPreferences,PhoneNumber,FaxNumber,EMailAddress,Photo,CustomFields,LastEditedBy,ValidFrom,ValidTo")] People people) { if (id != people.PersonId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(people); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PeopleExists(people.PersonId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(people)); }