summaryrefslogtreecommitdiff
path: root/Project-Unite/Controllers
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-03 09:08:57 -0400
committerMichael <[email protected]>2017-05-03 09:08:57 -0400
commit0cdba811a67c0fa8f9a68c8efa9280ea0cf22801 (patch)
tree596e1efc41f13e6e051bee1173dc22223cc094f1 /Project-Unite/Controllers
parent96cde6df23dd611054177cb90da90df2211e7f02 (diff)
downloadproject-unite-0cdba811a67c0fa8f9a68c8efa9280ea0cf22801.tar.gz
project-unite-0cdba811a67c0fa8f9a68c8efa9280ea0cf22801.tar.bz2
project-unite-0cdba811a67c0fa8f9a68c8efa9280ea0cf22801.zip
query other users' display names
Diffstat (limited to 'Project-Unite/Controllers')
-rw-r--r--Project-Unite/Controllers/APIController.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Project-Unite/Controllers/APIController.cs b/Project-Unite/Controllers/APIController.cs
index 1c96422..f225c68 100644
--- a/Project-Unite/Controllers/APIController.cs
+++ b/Project-Unite/Controllers/APIController.cs
@@ -213,7 +213,7 @@ namespace Project_Unite.Controllers
}
- public ActionResult GetDisplayName()
+ public ActionResult GetDisplayName(string id = "")
{
try
{
@@ -221,7 +221,14 @@ namespace Project_Unite.Controllers
var user = ACL.GetUserFromToken(token);
if (user == null)
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
{