我想允许用户更新他们的电子邮件,所以我有控制器:
[HttpPost]
public ActionResult ChangeEmail(string newEmail) {
IUser user = _services.WorkContext.CurrentUser;
if (!user.Is<UserPart>())
throw new InvalidCastException();
var userRecord = user.As<UserPart>().Record;
userRecord.Email = newEmail;
return null;
}
除了数据库不更新新电子邮件之外,一切都可以正常构建和运行。我应该怎么办 ?谢谢大家!