Last post Oct 06, 2017 07:36 AM by Cathy Zou
Oct 05, 2017 10:41 PM|paulltechguy|LINK
The project template for Visual Studio, at the time of this writing, includes a UserManager with extension methods such as SetPhoneNumberAsync.
I've added a few new fields to ApplicationUser (Identity 2.0) like FirstName and LastName.
Wondering the best way to update an existing ApplicationUser in the project template's OnPostAsync (interesting that the template code updates email and phone individually...but if there are like 6 fields that can be updated, making six latent calls for
save doesn't seem good).
Possibly write an extension method for each new property on ApplicationUser? I can't seem to figure out how to do this...what is the code to save just a single field from extension method? The source code for ApplicationUser uses several private methods
in that class to accomplish the save of a single field.
Given there could be n total properties in ApplicationUser, I'd rather just make a single call to update the entire ApplicationUser, but don't feel like manually setting every field.
Oct 06, 2017 07:36 AM|Cathy Zou|LINK
For your problem, as far as I know, there is two way for you.
First one is to update the ApplicationUser object,
The second is the use UserManager’s own update method
There is no difference in nature