I have model (ApplicationUser : Identity user) and I want to update several fields, but if I do not create the remaining fields of model (PasswordHash, PhoneNumber and etc.) then null is passed instead.
<div class="form-floating py-1 col-12">
<input asp-for="Email" type="text" class="form-control boarder-0 shadow" />
<label asp-for="Email" class="ms-2"></label>
<span asp-validation-for="Email" class="text-danger"></span>
</div>
<div class="form-floating py-1 col-12">
<input asp-for="UserName" type="text" class="form-control boarder-0 shadow" />
<label asp-for="UserName" class="ms-2"></label>
<span asp-validation-for="UserName" class="text-danger"></span>
</div>
if (ModelState.IsValid)
{
_unitOfWork.ApplicationUser.Update(userObj);
_unitOfWork.Save();
}
What is the best way to transfer only these changes, and fill the rest with what already exists and is not transferred from the view?