MVC5 ApplicationUser custom properties

前端 未结 3 1755
野的像风
野的像风 2021-01-01 01:55

I am trying to get to grips with the new Membership system introduced in ASP.NET MVC 5 and I\'ve come across a small issue which I am pretty sure you will be able to help me

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-01 02:42

    Explore IdentityManager.Store.UserManagement and IdentityManager.Store.Users.

    ApplicationUser cUser = (ApplicationUser) await IdentityManager.Store.Users.FindByNameAsync(HttpContext.User.Identity.Name, new System.Threading.CancellationToken());
    cUser.Surname = "New Something";
    IdentityResult result1 = await IdentityManager.Store.SaveChangesAsync();
    

    Above code is an example only. Basically you need to explore the Store property of IdentityManage.

提交回复
热议问题