Ejemplo n.º 1
0
        public async Task <ActionResult> VerifyEmail(string token, string email)
        {
            var isVerified = await _accountService.VerifyEmailAsync(token, email);

            if (!isVerified)
            {
                return(BadRequest(new ErrorResponse(new[] { "Failed to verify email" })));
            }

            return(Ok(SuccessResponse.DefaultOkResponse()));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> ForgotPassword(ForgotPasswordRequest request)
        {
            var sentEmail = await _accountService.ForgotPasswordAysnc(request.Email);

            if (!sentEmail)
            {
                return(BadRequest(new ErrorResponse(new[] { "Invalid Email" })));
            }

            return(Ok(SuccessResponse.DefaultOkResponse()));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Signup(SignupRequest request)
        {
            var authResponse = await _accountService.RegisterAsync(request.Name, request.Email, request.Password);

            if (!authResponse.Success)
            {
                return(BadRequest(new BusinessErrorResponse {
                    Errors = authResponse.ErrorMessages
                }));
            }

            return(Ok(SuccessResponse.DefaultOkResponse()));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> PlaceInvestment(PlaceInvestmentRequest request)
        {
            var order = _mapper.Map <InvestmentOrder>(request);

            order.UserId = HttpContext.GetUserId();
            var result = await _tradingService.PlaceInvestmentOrder(order);

            if (!result.Success)
            {
                return(BadRequest(new ErrorResponse(result.Errors)));
            }

            return(Ok(SuccessResponse.DefaultOkResponse()));
        }
Ejemplo n.º 5
0
 public IActionResult Logout()
 {
     _accountService.Logout(HttpContext.Response);
     return(Ok(SuccessResponse.DefaultOkResponse()));
 }