public int SaveProfile(MySettingsViewModel Data) { using (UserDataContext db = new UserDataContext()) { var User = db.tblUserData.Single(o => o.UserName.Equals(Data.UserName)); if (Data.ConfirmPassword == User.UserPassword) { User.UserName = Data.UserName; User.Email = Data.Email; User.FirstName = Data.FirstName; User.LastName = Data.LastName; User.Gender = Data.Gender; User.BirthDate = Data.BirthDate; var Address = db.tblAddress.Single(o => o.ID.Equals(User.AddressID)); Address.Country = Data.Country; Address.City = Data.City; Address.Region = Data.Region; Address.ZipCode = Data.ZipCode; Address.Street = Data.Street; Address.Number = Data.Number; Address.ApartmentNumber = Data.ApartmentNumber; db.SaveChanges(); return(0); } else { return(1); } } }
public MySettingsViewModel MyProfile() { MySettingsViewModel MyProfileView = new MySettingsViewModel(); using (UserDataContext db = new UserDataContext()) { var UserName = HttpContext.Current.User.Identity.Name; var User = db.tblUserData.Single((o => o.UserName.Equals(UserName))); var UserAddress = db.tblAddress.Single((o => o.ID.Equals(User.AddressID))); MyProfileView.UserName = User.UserName; MyProfileView.FirstName = User.FirstName; MyProfileView.LastName = User.LastName; MyProfileView.Email = User.Email; MyProfileView.Gender = User.Gender; MyProfileView.BirthDate = User.BirthDate; MyProfileView.Country = UserAddress.Country; MyProfileView.City = UserAddress.City; MyProfileView.Region = UserAddress.Region; MyProfileView.ZipCode = UserAddress.ZipCode; MyProfileView.Street = UserAddress.Street; MyProfileView.Number = UserAddress.Number; MyProfileView.ApartmentNumber = UserAddress.ApartmentNumber; } return(MyProfileView); }
public MySettings() { vm = new MySettingsViewModel(); Title = "Settings"; BindingContext = vm; InitializeComponent(); }
public async Task <PartialViewResult> MySettingsModal() { var output = await _profileAppService.GetCurrentUserProfileForEdit(); var viewModel = new MySettingsViewModel(output); return(PartialView("_MySettingsModal", viewModel)); }
public async Task <ActionResult> MySettings() { MySettingsViewModel model = new MySettingsViewModel(); model.LoggedInUser = await userService.GetCurrentUser(); List <String> destNames = new List <String>() { settingsActionDest }; model.FullNavList = CreateAccountControllerNavList(destNames); return(View(model)); }
public ActionResult MySettingsIndex(MySettingsViewModel tUD) { if (ModelState.IsValid) { UserManager US = new UserManager(); if (US.SaveProfile(tUD) == 1) { ModelState.AddModelError("", "Confirm password dont mach"); } else { tUD.SaveMessage = "Changes were saved"; } } return(View(tUD)); }
public async Task <PartialViewResult> MySettingsModal() { var output = await _profileAppService.GetCurrentUserProfileForEdit(); var timezoneItems = await _timingAppService.GetTimezoneComboboxItems(new GetTimezoneComboboxItemsInput { DefaultTimezoneScope = SettingScopes.User, SelectedTimezoneId = output.Timezone }); var viewModel = new MySettingsViewModel(output) { TimezoneItems = timezoneItems }; return(PartialView("_MySettingsModal", viewModel)); }
public async Task <PartialViewResult> MySettingsModal() { var output = await _profileAppService.GetCurrentUserProfileForEdit(); var timezoneItems = await _timingAppService.GetTimezoneComboboxItems(new GetTimezoneComboboxItemsInput { DefaultTimezoneScope = SettingScopes.User, SelectedTimezoneId = output.Timezone }); var viewModel = new MySettingsViewModel(output) { TimezoneItems = timezoneItems, SmsVerificationEnabled = await SettingManager.GetSettingValueAsync <bool>(AppSettings.UserManagement.SmsVerificationEnabled) }; return(PartialView("_MySettingsModal", viewModel)); }
public async Task <ActionResult> MySettings(MySettingsViewModel model) { List <String> destNames = new List <String>() { settingsActionDest }; if (String.IsNullOrEmpty(model.PaginationPreference) == false) { int pagination = 0; Int32.TryParse(model.PaginationPreference, out pagination); if (model.PaginationPreference.CompareTo("0") != 0 && pagination == 0) { ModelState.AddModelError(String.Empty, "Invalid pagination value selected."); model.LoggedInUser = await userService.GetCurrentUser(); model.FullNavList = CreateAccountControllerNavList(destNames); return(View(model)); } else { model.LoggedInUser.PaginationPreference = pagination; } } if (String.IsNullOrEmpty(model.AppIDs) == false) { model.SuccessfulItemsAdded = await userService.AddWishlistItems(model.AppIDs); } await userService.EditAppUserSettings(model.LoggedInUser); model.LoggedInUser = await userService.GetCurrentUser(); model.FullNavList = CreateAccountControllerNavList(destNames); return(View(model)); }
public MySettingsPage() { InitializeComponent(); this.BindingContext = _viewModel = new MySettingsViewModel(); _viewModel.SettingsLoaded += _viewModel_SettingsLoaded; }