Example #1
0
        public async Task <RequestResult <Fibonacci> > Read(int fibonacciId, CancellationToken cancellationToken)
        {
            var requestResult = new RequestResult <Fibonacci>();

            var entityFibonacci = await _iRepoBase.ReadSingle <EntityFibonacci>(a => a.FibonacciId == fibonacciId, cancellationToken);

            requestResult.Model = _iMapper.Map <Fibonacci>(entityFibonacci);

            return(requestResult);
        }
Example #2
0
        public async Task <RequestResult <User> > Read(int userId, CancellationToken cancellationToken)
        {
            var requestResult = new RequestResult <User>();

            var entityUser = await _iRepoBase.ReadSingle <EntityUser>(a => a.UserId == userId, cancellationToken);

            requestResult.Model = _iMapper.Map <User>(entityUser);

            return(requestResult);
        }
Example #3
0
        public async Task <RequestResult <RefreshToken> > Refresh(int userId, string refreshToken, CancellationToken cancellationToken)
        {
            var requestResult = new RequestResult <RefreshToken>();

            var entityRefreshToken = await _iRepoBase.ReadSingle <EntityRefreshToken>(a => a.UserId == userId && a.Token == refreshToken, cancellationToken);

            if (entityRefreshToken != null)
            {
                return(await Update(cancellationToken, userId, entityRefreshToken));
            }
            else
            {
                requestResult.Errors.Add("Invalid Refresh Token");
            }

            return(requestResult);
        }