Esempio n. 1
0
        public IActionResult getLogInUserTypeAndId(LogInUserTypeAndIdRequest userTypeAndIdRequest)
        {
            GetUserInformationFromTokenUseCase          useCase           = new GetUserInformationFromTokenUseCase(_UsersRepository);
            UseCaseBaseOutput <UserInformationResponse> useCaseBaseOutput = useCase.Process(userTypeAndIdRequest);

            if (useCaseBaseOutput.httpStatus != StatusCodes.Status200OK)
            {
                return(StatusCode(useCaseBaseOutput.httpStatus, "logOut Fails"));
            }
            return(StatusCode(useCaseBaseOutput.httpStatus, useCaseBaseOutput.value));
        }
        public UseCaseBaseOutput <UserInformationResponse> Process(LogInUserTypeAndIdRequest request)
        {
            User user = _UserRepository.getLogInUserInformation(request.token, request.ipAddress);

            if (user == null)
            {
                return(new UseCaseBaseOutput <UserInformationResponse>(new UserInformationResponse(), StatusCodes.Status500InternalServerError));
            }

            return(new UseCaseBaseOutput <UserInformationResponse>(new UserInformationResponse {
                id = user.id,
                type = user.type.ToString()
            }, StatusCodes.Status200OK));
        }