public ActionResult Edit(UpdateUserInput viewModel, string returnUrl = null)
 {
     if (ModelState.IsValid)
     {
     _userService.UpdateUserAccount(viewModel, UserContext.UserId);
     return Redirect(returnUrl ?? "/");
     }
     return View(viewModel);
 }
        public UpdateUserInput FindUser(int userId)
        {
            var user = _userRepo.Find(userId);

            //var updateUser = new UpdateUserInput();
            var updateUser = new UpdateUserInput()
            {
            FirstName = user.FirstName,
            LastName = user.LastName,
            Email = user.Email,
            IATA=user.IATA,
            Affiliation=user.Affiliation
            };

            if(user.Address!=null)
            {
              updateUser.Phone = user.Address.Phone;
              updateUser.City = user.Address.City;
            }

            return updateUser;
        }
        public User UpdateUserAccount(UpdateUserInput updateUserInput,int userId)
        {
            var user = _userRepo.Find(userId);
            user.FirstName = updateUserInput.FirstName;
            user.LastName = updateUserInput.LastName;
            user.Email = updateUserInput.Email;
            user.IATA = updateUserInput.IATA;
            user.Affiliation = updateUserInput.Affiliation;
            var address = user.Address ?? new Address();
            address.FirstName = user.FirstName;
            address.LastName = user.LastName;
            address.Phone = updateUserInput.Phone;
            address.City = updateUserInput.City;
            address.CountryId = 226;// TODO: hardcoded country for now
            user.Address = address;

            _userRepo.Update(user);
            FormsAuthenticationService service = new FormsAuthenticationService(this);
            service.SetAuthenticated(user, false);
            return user;
        }