Ejemplo n.º 1
0
        public IHttpActionResult Get(string username)
        {
            CcmUser user = _userManager.FindByUserName(username);

            if (user == null)
            {
                return(NotFound());
            }

            return(Ok(new UserModel()
            {
                UserName = user.UserName,
                DisplayName = user.DisplayName,
                Comment = user.Comment
            }));
        }
Ejemplo n.º 2
0
        public Task <CcmUser> FindByNameAsync(string userName)
        {
            if (string.IsNullOrWhiteSpace(userName))
            {
                throw new ArgumentException("Null or empty argument: userName");
            }

            CcmUser user = userManager.FindByUserName(userName);

            if (user != null)
            {
                return(Task.FromResult(user));
            }

            return(null);
        }