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 })); }
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); }