简体   繁体   中英

How to save a field in the AspNetUsers table

I have added a new field to the AspNetUsers table for the MVC application using EntityFramework code first model. I can access the field in one of my controllers by doing:

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

How do I actually set a value (true/false) back to the field in the database? can someone please help? Thanks.

您可以使用UpdateAsync方法来更新用户属性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM