Example #1
0
        public ActionResult ModifyInfo(AccountInfoViewModel model)
        {
            ResponseModel response = new ResponseModel();
            if (!ModelState.IsValid)
            {
                foreach (var item in ModelState)
                {
                    if (item.Value.Errors.Count > 0)
                    {
                        response.Success = false;
                        response.Msg = item.Value.Errors.FirstOrDefault().ErrorMessage;
                    }
                }
            }
            else
            {
                Account account = _accountService.GetById(model.Id);
                account.UpdateTime = DateTime.Now;
                account.Name = model.Name;
                account.PhoneNumber = model.PhoneNumber;
                account.Email = model.Email;
                _accountService.Update(account);
                _unitOfWork.Commit();
                response.Success = true;
                response.Msg = "已成功修改个人信息";
                response.RedirectUrl = Url.Action("Setting", "Account");
                return Json(response, JsonRequestBehavior.AllowGet);

            }
            return Json(response);

        }
Example #2
0
        public ActionResult ModifyInfo()
        {

            Account Information = _accountService.GetById(LoginAccount.Id);
            AccountInfoViewModel viewModel = new AccountInfoViewModel();
            viewModel.Amount = Information.Amount;
            viewModel.Name = Information.Name;
            viewModel.PhoneNumber = Information.PhoneNumber;
            viewModel.Email = Information.Email;
            viewModel.Id = Information.Id;
            return View(viewModel);
        }