Esempio n. 1
0
        public async Task <IActionResult> GetUserByIdAsync([FromRoute] string id, [FromServices] IUserApplicationService service)
        {
            if (!string.Equals(User.Identity.Name, id))
            {
                return(Forbid());
            }

            var registeredUser = await service.GetUserByIdAsync(id);

            if (registeredUser == null)
            {
                return(NotFound(new { reason = $"The user id {id} not found" }));
            }

            return(Ok(registeredUser));
        }