Exemple #1
0
        public ChangePasswordPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);

            _model         = new ChangePasswordPageViewModel();
            BindingContext = _model;

            InitializeComponent();
        }
        public IActionResult ChangePassword()
        {
            ChangePasswordPageViewModel model = new ChangePasswordPageViewModel()
            {
                Categories = _categoryLogic.GetAll().Select(c => new CategoryViewModel {
                    Id = c.CategoryId, Name = c.Name
                }).ToList(),
            };

            return(View(model));
        }
 public IActionResult ChangePassword(ChangePasswordPageViewModel model)
 {
     if (model.Password != null && (ModelState.IsValid))
     {
         User user = new User {
             UserId = (int)HttpContext.Session.GetInt32("UserId"), Password = model.Password
         };
         _accountLogic.UpdateUserPassword(user);
         return(RedirectToAction("Settings", "Account"));
     }
     return(RedirectToAction("Settings", "Account"));
 }