public IActionResult Edit(AttendeeEditViewModel viewModel) { if (!ModelState.IsValid) { // Something wasn't valid, send them back return(View(viewModel)); } // Rehydrate the model object and then append on top our changes var attendee = GetLoggedInUser(); // Sanity check if (attendee == null) { ModelState.AddModelError(string.Empty, "Error locating your Attendee profile from the database."); return(View(viewModel)); } // Append on top the changes attendee.FirstName = viewModel.FirstName; attendee.LastName = viewModel.LastName; attendee.Username = GetUsername(); attendee.Bio = viewModel.Bio; attendee.Photo = viewModel.Photo; attendee.BlogUri = viewModel.BlogUri; attendee.TwitterHandle = viewModel.TwitterHandle; attendee.LinkedInProfile = viewModel.LinkedInProfile; attendee.FacebookProfile = viewModel.FacebookProfile; // Actually save this model data! _attendeeService.SaveAttendee(); // Redirect back to Index() return(RedirectToAction("Index")); }