more efficient way to write this?
I've been trying to find good LINQ documentation for lambda fx and could not figure out if there was a quicker way to write something like this. I tried using results.Errors.Select(x => ModelState.AddError(x.Code, x.Description) but i idk if its just my syntax or theres something else for that.. Trying to reduce the amount of loops i write.
var result = await UserManager.UpdateAsync(aspNetUser); if (result.Errors.Any()) { foreach (var err in result.Errors) { ModelState.AddModelError(err.Code, err.Description); } return View("~/Views/Administration/User/Create.cshtml", Model); }
0 comments:
Post a Comment