/// <summary> /// 账户首页 /// </summary> /// <returns></returns> public ActionResult Index() { var userId = User.GetUserId <Guid>(); var u = _bLLUser.Fetch(x => x.UserId == userId); return(View(u)); }
public ActionResult CreateAccount(CreateAccountViewModel accountModel) { if (ModelState.IsValid) { //验证用户名唯一 var u = _bLLUser.Fetch(s => s.UserName == accountModel.Username); if (u != null) { return(Json(false)); } //验证用户邮箱唯一 u = _bLLUser.Fetch(s => s.UserMail == accountModel.UserEmail); if (u != null) { return(Json(false)); } u = new User() { UserId = Guid.NewGuid(), UserName = accountModel.Username, UserPassword = SecurityHelper.SHA256_Encrypt(accountModel.UserPassword), UserMail = accountModel.UserEmail }; try { var count = _bLLUser.Insert(u); if (count == 1) { OperLogHelper.AddOperLog( string.Format("添加用户 {0}-{1} 成功", accountModel.Username, accountModel.UserEmail), OperLogModule.Account, Username); return(Json(true)); } } catch (Exception ex) { Logger.Error(ex); } } return(Json(false)); }