예제 #1
0
        public async Task <IActionResult> GetUser(string name)
        {
            var query = new OneUserQuery {
                Name = name
            };
            var user = await _messages.Dispatch(query);

            return(Ok(user));
        }
예제 #2
0
        public async Task<User> Get(OneUserQuery query)
        {
            var u = await _userManager.FindByNameAsync(query.Name);

            if (u == null)
                throw new NotFoundException($"user {query.Name} not found");

            return new User { ID = u.Id, Name = u.UserName };
        }