Stackedup
Stackedup

Reputation: 760

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.

Upvotes: 0

Views: 51

Answers (1)

Vitaly Yakovenko
Vitaly Yakovenko

Reputation: 41

You can use UpdateAsync method for update user properties.

Upvotes: 1

Related Questions