public async Task<EditProfileVm> GetUserProfile()
 {
     var vm = new EditProfileVm();
     var user = await this.userRepository.GetUser(this.userSessionHelper.UserId);
     if (user != null)
     {
         vm.Name = user.Name;
         vm.Email = user.EmailAddress;
     }
     return vm;
 }
        public async Task<ActionResult> EditProfile(EditProfileVm model)
        {
            if (ModelState.IsValid)
            {
                await _userAccountManager.UpdateProfile(model);
                SetMessage(MessageType.Success, "Profile updated successfully");
                return RedirectToAction("Index", "Settings");

            }
            //TO DO : Redirect to the Tab ?
            return RedirectToAction("Index");
        }
        public ActionResult EditProfile(EditProfileVm model)
        {
            if (ModelState.IsValid)
            {
                userAccountManager.UpdateProfile(model);
                var msg = new AlertMessageStore();
                msg.AddMessage("success", "Profile updated successfully");
                TempData["AlertMessages"] = msg;
                return RedirectToAction("Index", "Settings");

            }
            //TO DO : Redirect to the Tab ?
            return RedirectToAction("Index");
        }
 public async Task UpdateProfile(EditProfileVm model)
 {
     model.Id = this.userSessionHelper.UserId;
     await userRepository.SaveUserProfile(model);
 }
Пример #5
0
 public async Task SaveUserProfile(EditProfileVm userProfileVm)
 {
     var q = @"UPDATE [User] SET FirstName=@name WHERE ID=@userId";
     using (var con = new SqlConnection(ConnectionString))
     {
         con.Open();
         await con.ExecuteAsync(q, new { @userId = userProfileVm.Id, @name = userProfileVm.Name });
     }
 }
 public void UpdateProfile(EditProfileVm model)
 {
     accountRepository.UpdateProfile(new UserAccountDto {Name = model.Name, EmailAddress = model.Email});
 }