Esempio n. 1
0
 public UserService(IUserCommandHandler commandHandler, IUserQueryHandler queryHandler,
                    IMapper mapper, ICryptoService cryptoService)
 {
     _commandHandler = commandHandler;
     _queryHandler   = queryHandler;
     _mapper         = mapper;
     _cryptoService  = cryptoService;
 }
Esempio n. 2
0
 public AuthController(
     IUserRepository repository,
     IUserCommandHandler handler,
     TokenService tokenService,
     EmailService emailService)
 {
     _tokenService = tokenService;
     _repository   = repository;
     _handler      = handler;
     _emailService = emailService;
 }
Esempio n. 3
0
 public UserAppService(IUserCommandHandler userCommandHandler,
                       IUserQueryHandler userQueryHandler,
                       ISecurityTokenService securityTokenService,
                       ICacheService cacheService,
                       CacheConfiguration cacheConfiguration)
 {
     _userCommandHandler   = userCommandHandler ?? throw new ArgumentNullException(nameof(userCommandHandler));
     _userQueryHandler     = userQueryHandler ?? throw new ArgumentNullException(nameof(userQueryHandler));
     _securityTokenService = securityTokenService ?? throw new ArgumentNullException(nameof(securityTokenService));
     _cacheService         = cacheService ?? throw new ArgumentNullException(nameof(cacheService));
     _cacheConfiguration   = cacheConfiguration ?? throw new ArgumentNullException(nameof(cacheConfiguration));
 }
        public async Task <IActionResult> SignIn([FromServices] IUserCommandHandler userCommandHandler, [FromBody] SingInUserRequest singIn)
        {
            if (ModelState.IsValid)
            {
                var user = await userCommandHandler.Handler(singIn);

                if (user.Error)
                {
                    return(Response(user));
                }

                var response = TokenService.GereneteToken((UserResponse)user.Data, _appSettings);

                return(Response(new CommandResponse(user.StatusCode, user.Message, response)));
            }

            return(BadRequest());
        }
Esempio n. 5
0
 public CommandResult UpdatePassword([FromServices] IUserCommandHandler handler,
                                     [FromBody] UserUpdatePasswordCommand command)
 {
     return(handler.UpdatePassword(command, User.Identity.Name));
 }
        public async Task <IActionResult> SignUp([FromServices] IUserCommandHandler userCommandHandler, [FromBody] CreateUserRequest createUserRequest)
        {
            var response = await userCommandHandler.Handler(createUserRequest);

            return(Response(response));
        }