public async Task <IActionResult> SubscribeAsync([FromRoute] SubscriptionTypeEnum type)
        {
            return(await _exceptionService.HandleApiExceptionAsync <ApiException>(nameof(AccountController), nameof(SubscribeAsync), async() =>
            {
                var user = await _userService.SubscribeUserAsync(_authenticationService.GetUserEmail(), type);

                return Ok();
            }));
        }
        public async Task <IActionResult> LogInAsync([FromBody] LogInRequest request)
        {
            return(await _exceptionService.HandleApiExceptionAsync <ApiException>(nameof(AuthenticationController), nameof(LogInAsync), async() =>
            {
                AccessToken accessTokenResponse = await _authenticationService.LogInAsync(request.Email, request.Password);

                LogInResponse logInResponse = _mapper.Map <AccessToken, LogInResponse>(accessTokenResponse);

                return Ok(logInResponse);
            }));
        }
Exemple #3
0
        public async Task <IActionResult> RegisterAsync([FromBody] RegisterRequest request)
        {
            return(await _exceptionService.HandleApiExceptionAsync <ApiException>(nameof(AccountController), nameof(RegisterAsync), async() =>
            {
                User user = _mapper.Map <RegisterRequest, User>(request);

                User userRespose = await _userService.CreateUserAsync(user, request.Password);
                return Ok();
            }));
        }