public ActionResult Index(ProfileSettingsViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     string userId = User.Identity.GetUserId();
     DataManager.User.UpdateUser(userId, model);
     return RedirectToAction("index", new { message = ManageMessageId.ProfileEditSuccess });
 }
 public void UpdateUser(string id, ProfileSettingsViewModel model)
 {
     var user = GetUserById(id);
     user.FristName = model.FirstName;
     user.Surname = model.Surname;
     user.PhoneNumber = model.Telphone;
     user.Address = model.Address;
     user.Id_City = model.City;
     user.withTravel = model.WithTravel != null;
     context.SaveChanges();
     UpdateUserDescription(id, model.Description);
 }
        public ActionResult Index(ManageMessageId? message)
        {   
            ViewBag.StatusMessage =
                message ==  ManageMessageId.ProfileEditSuccess? "Ваш профиль был обновлён."
                : message == ManageMessageId.AvatarUpdated ? "Ваша аватарка была измененена."
                : message == ManageMessageId.ChangePasswordSuccess ? "Ваш пароль был изменён."
                : message == ManageMessageId.SetPasswordSuccess ? "Ваш пароль был установлен."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "Ошибка, попробуйте еще раз."
                : message == ManageMessageId.AddPhoneSuccess ? "Ваш телефон был добавлен."
                : message == ManageMessageId.RemovePhoneSuccess ? "Ваш телефон был удалён."
                : "";

            var userId = User.Identity.GetUserId();
            var user = DataManager.User.GetUserById(userId);
            var description = DataManager.User.GetUserDescription(userId);
            var cities = DataManager.Geolocation.GetAllCities();
            var model = new ProfileSettingsViewModel
            {
                UserName = user.UserName,
                City = user.Id_City,
                Address = user.Address,
                Email = user.Email,
                FirstName = user.FristName,
                Avatar_Url = user.Avatar_Url,
                Surname = user.Surname,
                Telphone = user.PhoneNumber,
                Description = description,
                City_List = cities,
                WithTravel = user.withTravel == true? "true" : null
            };
            return View(model);
        }