Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在AspNetUsers表中保存字段_C#_Model View Controller - Fatal编程技术网

C# 如何在AspNetUsers表中保存字段

C# 如何在AspNetUsers表中保存字段,c#,model-view-controller,C#,Model View Controller,我使用EntityFramework代码优先模型为MVC应用程序的AspNetUsers表添加了一个新字段。我可以通过以下操作访问我的一个控制器中的字段: var currentUser = await HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>().FindByIdAsync(User.Identity.GetUserId()); bool isPrivateModeOn = curre

我使用EntityFramework代码优先模型为MVC应用程序的AspNetUsers表添加了一个新字段。我可以通过以下操作访问我的一个控制器中的字段:

 var currentUser = await HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>().FindByIdAsync(User.Identity.GetUserId());
 bool isPrivateModeOn = currentUser.IsPrivateMode;
var currentUser=wait HttpContext.GetOwinContext().GetUserManager().FindByIdAsync(User.Identity.GetUserId());
bool isPrivateModeOn=currentUser.IsPrivateMode;

如何将值(真/假)设置回数据库中的字段?有人能帮忙吗?谢谢。

你可以用它来更新用户属性。

至关重要的是,太棒了。非常感谢。