public ActionResult Index()
        {
            InfoUpdateModel updateModel = new InfoUpdateModel();
            string          id          = User.Identity.GetUserId();
            var             info        = userManager.FindById(id);

            updateModel.eMail       = info.Email;
            updateModel.fullName    = info.FullName;
            updateModel.phoneNumber = info.PhoneNumber;
            updateModel.userName    = info.UserName;
            return(View(updateModel));
        }
        public ActionResult Index(InfoUpdateModel model)
        {
            string id   = User.Identity.GetUserId();
            var    info = userManager.FindById(id);

            info.FullName    = model.fullName;
            info.Email       = model.eMail;
            info.PhoneNumber = model.phoneNumber;
            userManager.Update(info);
            if (model.newPassword != null && model.oldPassword != null)
            {
                userManager.ChangePassword(id, model.oldPassword, model.newPassword);
            }
            return(RedirectToAction("Index", "Home"));
        }
Example #3
0
        public void SetSolved(long chatId, string taskKey, bool solved)
        {
            var time = DateTime.Now;
            var data = new InfoUpdateModel
            {
                answerTime = time,
                state      = solved,
                timestamp  = (int)time.TimeOfDay.TotalMilliseconds
            };

            Database
            .Child("history")
            .Child(chatId.ToString)
            .Child(taskKey)
            .PatchAsync(data);
        }