fixed the launch error I was gettign

This commit is contained in:
adam 2025-01-28 17:09:23 -05:00
parent c0cfa90874
commit 2793e6ef76
3 changed files with 17 additions and 11 deletions

2
.vscode/launch.json vendored
View File

@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net7.0/vassago.dll",
"program": "${workspaceFolder}/bin/Debug/net8.0/vassago.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,

View File

@ -18,11 +18,18 @@ public class User
{
get
{
return Accounts.Select(a => a.DisplayName).Distinct()
.MaxBy(distinctName =>
Accounts.Select(a => a.DisplayName)
.Where(selectedName => selectedName == distinctName).Count()
);
if (Accounts?.Any() ?? false)
{
return Accounts.Select(a => a.DisplayName).Distinct()
.MaxBy(distinctName =>
Accounts.Select(a => a.DisplayName)
.Where(selectedName => selectedName == distinctName).Count()
);
}
else
{
return $"[accountless {Id}";
}
}
}
}

View File

@ -166,11 +166,10 @@ public class HomeController : Controller
}
private void serializeUser(ref StringBuilder sb, ref List<Account> allAccounts, User currentUser)
{
sb.Append($"{{\"text\": " +
$"\"<a href=\\\"{Url.ActionLink(action: "Details", controller: "Users", values: new {id = currentUser.Id})}\\\">"
+ currentUser.DisplayName +
"</a>\", ");
// \"{currentUser.DisplayName}\", ");
Console.WriteLine(currentUser);
sb.Append($"{{\"text\": \"<a href=\\\"{Url.ActionLink(action: "Details", controller: "Users", values: new {id = currentUser.Id})}\\\">");
sb.Append(currentUser.DisplayName);
sb.Append("</a>\", ");
var ownedAccounts = allAccounts.Where(a => a.IsUser == currentUser);
sb.Append("nodes: [");
sb.Append($"{{\"text\": \"owned accounts:\", \"expanded\":true, \"nodes\": [");