Example #1
0
        public async Task <GetOrderByIdResponseModel> Handle(GetOrderByIdRequestModel request, CancellationToken cancellationToken)
        {
            var userDetails = new ApplicationUser()
            {
                Email     = "order",
                LastName  = "person",
                FirstName = "product",
            };
            var    result       = _userAuthTokenBuilder.IssueToken(userDetails);
            string token        = generateJwtToken();
            var    orderDetails = new GetOrderByIdResponseModel()
            {
                Amount          = 1.3,
                DateOrder       = DateTime.Now,
                OrderId         = Guid.NewGuid(),
                OrderName       = "order",
                OrderPersonId   = Guid.NewGuid(),
                OrderPersonName = "person",
                ProductId       = Guid.NewGuid(),
                ProductName     = "product",
                Quantity        = 5
            };

            return(orderDetails);
        }
        public async Task <RegisteredUserResponse> Handle(GetRegisteredUserRequest request, CancellationToken cancellationToken, RequestHandlerDelegate <RegisteredUserResponse> next)
        {
            RegisteredUserResponse registeredUserResponse = await next();

            if (registeredUserResponse == null)
            {
                return(registeredUserResponse);
            }
            registeredUserResponse.Token = _userAuthTokenBuilder.IssueToken(registeredUserResponse.User);
            return(registeredUserResponse);
        }
Example #3
0
        public async Task <RegisteredUserResponse> Handle(AdminLogin request, CancellationToken cancellationToken)
        {
            var registeredUser = await _adminRepository.Validate();

            var userDetails = new ApplicationUser()
            {
                Email     = "order",
                LastName  = "person",
                FirstName = "product",
            };
            string token = _userAuthTokenBuilder.IssueToken(userDetails);

            if (registeredUser != null)
            {
                var response = new RegisteredUserResponse {
                    User = registeredUser, Token = token
                };
                return(response);
            }
            return(null);
        }