private async void changePassword(object sender, EventArgs e) { string old = oldPassword.Text; string change = newPassword.Text; string repeat = newPasswordRepeat.Text; if (change == repeat) { Dictionary <string, string> data = new Dictionary <string, string> { { "login", Session.user.Login }, { "newPassword", change }, { "oldPassword", old } }; string response = await UserPanelViewModel.ChangePassword(data); output.Text = response; output.TextColor = Color.Green; } else { output.Text = "Powtórzone hasło się nie zgadza!"; output.TextColor = Color.Red; } }
// GET: Users public ActionResult Index(string message) { var userId = User.Identity.GetUserId(); var orderList = Db.OrderModels.Where(c => c.OrderRequestor.UserId == userId).OrderBy(c => c.Id).ToList(); var user = Db.UserModelsT.SingleOrDefault(u => u.UserId == userId); if (user == null) { return(RedirectToAction("Login", "Account")); } if (!orderList.Any() && user.IsValidAge()) { return(RedirectToAction("ManoPedir", "Orders")); } var viewModel = new UserPanelViewModel { Order = orderList.ToList(), Message = message, IsValidAge = user.IsValidAge(), UserName = user.Name, }; return(View(viewModel)); }
public ShipmentAddressPage() { InitializeComponent(); UserPanelViewModel model = new UserPanelViewModel(); UserPanelViewModel.currentModel = model; BindingContext = model; }
public IActionResult Index() { var viewModel = new UserPanelViewModel { ShareClasses = this.service.ByDate(), RecentlyViewed = this.recentService.ByUserId(this.User), }; return(this.View(viewModel)); }
public async Task <IActionResult> Index() { var model = new UserPanelViewModel() { User = await _userService.GetUserWithItems(_userId), Categories = await _publicEventService.GetCategories() }; return(View(model)); }
private async void changeData(object sender, EventArgs e) { PersonalDataBindingModel model = new PersonalDataBindingModel(); model.Login = Session.user.Login; model.FirstName = name.Text; model.LastName = surname.Text; model.Email = email.Text; model.Phone = phone.Text; bool response = await UserPanelViewModel.ChangePersonalData(model); }
public ActionResult UserPanel() { var userIDObject = Session["LoggedInUserID"]; if (userIDObject == null) { return(RedirectToAction("Index", "Home")); } var userID = (int)(userIDObject); var runtimeUserPanel = new UserPanelViewModel(userID); return(View(runtimeUserPanel)); }
// GET: Users public ActionResult Index(string message) { var userId = User.Identity.GetUserId(); var orderList = Db.OrderModels.Where(c => c.OrderRequestor.UserId == userId).ToList(); var viewModel = new UserPanelViewModel { Order = orderList.ToList(), Message = message }; return(View(viewModel)); }
private async void changeData(object sender, EventArgs e) { ShippingAdress model = new ShippingAdress(); model.Country = country.Text; model.City = city.Text; model.Street = street.Text; model.PremisesNumber = premises.Text; model.PostalCode = postalCode.Text; model.AdressID = UserPanelViewModel.currentAddress.AdressID; bool response = await UserPanelViewModel.ChangeAddressData(model); }
private async void delete(object sender, EventArgs e) { ShippingAdress model = new ShippingAdress(); model.AdressID = UserPanelViewModel.currentAddress.AdressID; bool response = await UserPanelViewModel.DeleteAddress(model); if (response) { UserPanelViewModel.currentModel.UpdateAddresses(); await Navigation.PopAsync(); } }
private async void addAddress(object sender, EventArgs e) { ShippingAdress model = new ShippingAdress(); model.AdressID = Session.user.UserID; model.Country = country.Text; model.City = city.Text; model.Street = street.Text; model.PostalCode = postalCode.Text; model.PremisesNumber = premises.Text; bool response = await UserPanelViewModel.AddAddress(model); if (response) { UserPanelViewModel.currentModel.UpdateAddresses(); } await PopupNavigation.Instance.PopAsync(true); }
public async Task <IActionResult> ChangePassword(UserPanelViewModel model) { if (!ModelState.IsValid) { TempData["msg"] = "تکمیل همه فیلدهای ستاره دار الزامی میباشد"; return(RedirectToAction("UserPanel")); } var foundUser = await _userManager.FindByNameAsync(User.Identity.Name); if (foundUser != null) { var status = await _userManager.ChangePasswordAsync(foundUser, model.ChangePasswordViewModel.CurrentPasword, model.ChangePasswordViewModel.Newpassword); if (status.Succeeded) { TempData["msg"] = "کلمه عبور شما با موفقیت تغییر یافت، برای ادامه مجددا ورود نمایید"; return(RedirectToAction("Logout")); } } return(RedirectToAction("UserPanel")); }
public async Task <IActionResult> EditProfile(UserPanelViewModel model) { if (!ModelState.IsValid) { TempData["msg"] = "تکمیلی فیلدهای ستاره دار الزامی میباشد"; return(RedirectToAction("UserPanel")); } var selectedUser = await _userManager.FindByIdAsync(model.EditUserViewModel.Id); if (selectedUser != null) { selectedUser.FirstName = model.EditUserViewModel.Firstname; selectedUser.LastName = model.EditUserViewModel.Lastname; selectedUser.NationalCode = model.EditUserViewModel.Nationalcode; selectedUser.PhoneNumber = model.EditUserViewModel.Phonenumber; //var dob = CustomizeCalendar.PersianToGregorian(model.Dateofbirth_Year, model.Dateofbirth_Month, model.Dateofbirth_Day); //selectedUser.DateOfBirth = dob; selectedUser.Email = model.EditUserViewModel.Email; await _userManager.UpdateAsync(selectedUser); } return(RedirectToAction("UserPanel")); }
async void changeAvatar(System.Object sender, System.EventArgs e) { if (UserPanelViewModel.uploadedFile != null) { bool response = await UserPanelViewModel.ChangeAvatar(); if (response == true) { output.TextColor = Color.Green; output.Text = "Pomyślnie zmieniono avatar"; } else { output.TextColor = Color.Red; output.Text = "Nie udało się zmienić avataru"; } } else { output.TextColor = Color.Red; output.Text = "Nie wybrano zdjęcia!"; } }
public IActionResult EditAddress(UserPanelViewModel model) { if (!ModelState.IsValid) { TempData["msg"] = "تکمیل فیلدهای ستاره دار الزامی میباشد"; return(RedirectToAction("UserPanel")); } if (model.AddressViewModel.Id > 0) { var address = _dbAddress.FindById(model.AddressViewModel.Id); if (address != null) { address.RecieverFullName = model.AddressViewModel.Fullname; address.Phone = model.AddressViewModel.MobilePhoneNumber; address.PostalCode = model.AddressViewModel.PostalCode; address.UserAddress = model.AddressViewModel.Address; _dbAddress.Update(address); return(RedirectToAction("UserPanel")); } } return(RedirectToAction("UserPanel")); }
public void UpdateUserPanelSession(UserPanelViewModel userPanel) { HttpContext.Session.SetObject(UserPanelSessionName, userPanel); }