示例#1
0
        public async Task <IActionResult> GetAsync([FromRoute] int id)
        {
            var user = await _manager.UserRepository.GetAsync(id, false);

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

            return(Ok(UserMapper.CompleteMap(user)));
        }
示例#2
0
        public async Task <IActionResult> GetAsync()
        {
            var users = await _manager.UserRepository.GetAsync(false);

            if (users.ToList().Count == 0)
            {
                return(NotFound());
            }

            return(Ok(users.Select(u => UserMapper.CompleteMap(u))));
        }
示例#3
0
        public async Task <IActionResult> GetSignedInAsync()
        {
            var userId = HttpContext.User.GetUserId();

            if (!userId.HasValue)
            {
                return(Unauthorized());
            }

            var user = await _manager.UserRepository.GetAsync(userId.Value, false);

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

            return(Ok(UserMapper.CompleteMap(user)));
        }