This question already has an answer here:

I am trying to change a variable in the user state in MVC 5

// POST: /Account/Registered
public async Task<ActionResult> Registered(loggedinViewModel model, ApplicationUser user, string selcteditem)
    if (ModelState.IsValid)
        var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new UserDb()));                
        var store = new UserStore<ApplicationUser>(new UserDb());
        var currentUser = manager.FindById(User.Identity.GetUserId());

        var newCID = clubIDMethod();

        var ctx = store.Context as UserDb;


        SelectedNewCID(model, newCID);

        ViewBag.newCID = (model.SelectedGodCID);

        user.CID = ViewBag.newCID;

        currentUser.CID = user.CID;                

    return View(model);  

I am really unsure what the state is not being saved, the currentUser.CID is being updated but then when I go else where it's still set to the original value

Please Help Thanks

Related posts

Recent Viewed