public async Task <ActionResult> Edit(CustomerProfileEdit CustomerProfile) { // Check the model state if (!ModelState.IsValid) { return(View(CustomerProfile)); } // Get the customers var Customer = await UserManager.FindByNameAsync(User.Identity.Name); // update the customer Customer.City = CustomerProfile.City; Customer.FName = CustomerProfile.FName; Customer.LName = CustomerProfile.LName; Customer.MiddleInitial = CustomerProfile.MiddleInitial; Customer.PhoneNumber = CustomerProfile.PhoneNumber; Customer.State = CustomerProfile.State; Customer.StreetAddress = CustomerProfile.StreetAddress; Customer.Zip = CustomerProfile.Zip; // Update the customer var result = await UserManager.UpdateAsync(Customer); return(RedirectToAction("Portal", "Home")); }
// GET: /Profile/Edit // Edit the customer's profile public async Task <ActionResult> Edit() { // Get the customers var Customer = await UserManager.FindByNameAsync(User.Identity.Name); // Build out the view CustomerProfileEdit CustomerProfile = new CustomerProfileEdit { City = Customer.City, FName = Customer.FName, LName = Customer.LName, MiddleInitial = Customer.MiddleInitial, PhoneNumber = Customer.PhoneNumber, State = Customer.State, StreetAddress = Customer.StreetAddress, Zip = Customer.Zip }; return(View("Edit", CustomerProfile)); }