From 76aff92ce902aaeef6f52151fbf5982daecdbe4b Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 11 Jun 2018 13:25:48 +0200 Subject: [PATCH] a user name hint web api ... --- Yavsc/ApiControllers/accounting/ProfileApiController.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Yavsc/ApiControllers/accounting/ProfileApiController.cs b/Yavsc/ApiControllers/accounting/ProfileApiController.cs index e281e4fc..876b88b9 100644 --- a/Yavsc/ApiControllers/accounting/ProfileApiController.cs +++ b/Yavsc/ApiControllers/accounting/ProfileApiController.cs @@ -32,5 +32,13 @@ namespace Yavsc.ApiControllers.accounting _dbContext.SaveChanges(User.GetUserId()); return Ok(new { monthlyEmailPrefSaved = allow }); } + + [HttpGet("userhint/{name}")] + public UserInfo[] GetUserHint(string name) + { + return _dbContext.Users.Where(u=>u.UserName.IndexOf(name)>0) + .Select(u=>new UserInfo(u.Id, u.UserName, u.Avatar)) + .Take(10).ToArray(); + } } } \ No newline at end of file