C
C#14mo ago
XD

❔ Why isn't one of my Identity user field being updated?

Code: https://gist.github.com/JsPeanut/b59cc1d4da3ababc532fe3b6e8a9ad69 The void ChangeUserCategoryValue, which is called at line 180 and 208, is responsible for changing user's corresponding field. It doesn't work for some reason and I can't figure it out
Gist
CategoriesController.cs
GitHub Gist: instantly share code, notes, and snippets.
3 Replies
Angius
Angius14mo ago
You have a lot of async calls there byt none of them is awaited Also, you could simplify this code by a lot if you were to pull
_context.SaveChanges();
_userManager.UpdateAsync(user);
_context.SaveChanges();
_userManager.UpdateAsync(user);
out of the switch
XD
XDOP14mo ago
Will look into it, thank you! @ZZZZZZZZZZZZZZZZZZZZZZZZZ it seems it was because of that and also because I initialized my decimal fields previously as null, so when adding numbers, the field would still be null. Now I initialized them as 0, thank you
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?