mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 17:22:15 +00:00
query other users' display names
This commit is contained in:
parent
96cde6df23
commit
0cdba811a6
1 changed files with 9 additions and 2 deletions
|
@ -213,7 +213,7 @@ public ActionResult GetPongHighscores()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ActionResult GetDisplayName()
|
public ActionResult GetDisplayName(string id = "")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -221,7 +221,14 @@ public ActionResult GetDisplayName()
|
||||||
var user = ACL.GetUserFromToken(token);
|
var user = ACL.GetUserFromToken(token);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.Forbidden);
|
return new HttpStatusCodeResult(HttpStatusCode.Forbidden);
|
||||||
return Content(user.DisplayName);
|
if(string.IsNullOrWhiteSpace(id))
|
||||||
|
return Content(user.DisplayName);
|
||||||
|
|
||||||
|
var db = new ApplicationDbContext();
|
||||||
|
var uwithid = db.Users.FirstOrDefault(x => x.Id == id);
|
||||||
|
if (uwithid == null)
|
||||||
|
return new HttpStatusCodeResult(404);
|
||||||
|
return Content(uwithid.DisplayName);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue