Ejemplo n.º 1
0
        public async Task <IActionResult> Profile([FromServices] ProfileUserCommand command)
        {
            var result = await _handler.Handler(command);

            if (result.Succeeded)
            {
                result.Message = _localizer["FIND_PROFILE_SUCCESS"].Value;
                return(Ok(result));
            }
            result.Message = _localizer["FIND_PROFILE_FAILED"].Value;
            return(NotFound(result));
        }
Ejemplo n.º 2
0
        public async Task <ICommandResult> Handler(ProfileUserCommand command)
        {
            try
            {
                User user = await _service.GetByEmailAsync(command.Email);

                if (user == null)
                {
                    return(new CommandResult(false, Messages.USER_NOT_FOUND, null));
                }
                return(new CommandResult(true, Messages.USER_FOUND, user.Response()));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }