public void Initialize() { InitExportCmd(); InitDelUserCmd(); this._MainViewModel.AddUserCmd = new RelayCommand(() => { AddUserView view = new AddUserView(Common.Service, Common.SessionId); view.Owner = Common.MainWindow; view.ShowDialog(); }); this._MainViewModel.SaveUserCmd = new RelayCommand(() => { if (_MainViewModel.UserView.CurrentItem == null) return; UserModel model = _MainViewModel.UserView.CurrentItem as UserModel; UpdateUserView view = new UpdateUserView(model, Common.Service, Common.SessionId); view.Owner = Common.MainWindow; view.ShowDialog(); }); this._MainViewModel.QueryFundCmd = new RelayCommand(() => { FundManager.Default.LoadFundCode(); }); }
private void Button1_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent) { BubbleEvent = true; if (SelectedRow != 0) { UpdateUserView view = new UpdateUserView(Users[SelectedRow - 1], UserController, this); view.Show(); SelectedRow = 0; } else { MessageBox.Show("Select item"); } }
/// <summary> /// ProjectView daki User Listesini UpdateUserView Formuna Gönderen Metod /// </summary> public void GetUserDetail() { if (SelectedUser != null) { using (UpdateUserView updateUserView = new UpdateUserView(SelectedUser)) { updateUserView.updateUserViewModel.ProjectViewModel = this; updateUserView.Show(); } } else { MessageBox.Show("Please Select User.."); } }
/// <summary> /// Sınıf Oluşturulğunda ilk Çalışan Metod /// </summary> public UpdateUserViewModel(UpdateUserView updateUserView, User user) { this.updateUserView = updateUserView; //UserGetAll = user; UserGetAll = new User() { Id = user.Id, Username = user.Username, Password = user.Password, Name = user.Name, Phone = user.Phone, Base64Image = user.Base64Image }; Base64Image = UserGetAll.Base64Image; }
public ActionResult Update(UpdateUserView model) { try { var entity = _unitOfWork.UserRepository.GetById(model.Id); if (entity != null) { Mapper.Map(entity, model); return(View(model)); } return(RedirectToAction("Index")); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult UpdatePost(UpdateUserView model) { if (ModelState.IsValid) { try { var entity = Mapper.Map <User>(model); _unitOfWork.UserRepository.Update(entity); _unitOfWork.Save(); SuccessNotification("更新成功"); return(RedirectToAction("Index")); } catch (Exception ex) { throw new Exception(ex.Message); } } return(View(model)); }
public async Task <IActionResult> UpdateUser(UpdateUserView model) { try { //Поиск текущего пользователя var user = await CurrentUser(); if (user == null) { throw new Exception("Не найден пользователь"); } //Проверка пароля var heshOldPassword = MD5Helper.GetMD5Hash(model.OldPassword); if (user.PasswordHash != heshOldPassword) { return(StatusCode(401, "Не правильный пароль")); } if (!model.Validate(out string errors)) { return(StatusCode(400, errors)); } //Обновление пароля пользователя model.UpdateDbModel(user); await _userRepository.Update(user); var token = await Authorize(user.Email, model.NewPassword); if (token == null) { throw new Exception("Не удалось получить новый токен"); } //Выдача нового токена доступа return(Ok(await Authorize(user.Email, model.NewPassword))); } catch (Exception ex) { return(StatusCode(500, "Не удалось обновить учетную запись. СОобщите нам об этой ошибке.")); } }
public async Task UpdateUserAsync(UpdateUserView userView) { throw new System.NotImplementedException(); }