Closed DanielRodFT closed 9 months ago
Hello @DanielRodFT
One more time thank you for using LiteDb.Identity :)
I have just verified this, and it is functioning as expected. After creating the user, a new ID is returned to the user instance. To be doubly sure, I have created a new unit test for it. Please refer to the screenshots below.
Based on your screenshot, I assume this is a POST action for updating a user from an MVC form submission. Could you please double-check whether you are correctly storing the user.Id on the form after creation?
Please see pseudo code below :
@using (Html.BeginForm("ActionName", "ControllerName", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.UserId)
...
}
Regards Piotr
Thank you for your help. As you mentioned it was due to the MVC model binder not being able to recreate the Id from the url. I'm now able to edit and delete users. Thanks:)
When trying to update or delete a user, the user passed to my controller's UpdateUser method doesn't have an ID, the id property is null. I'm using the same exact process with Microsoft own Identity and the ID does return. I don't know if theres something I'm doing wrong of updating doesn't work the same as with microsoft's identity. The object does exist in the database and has a working Id.