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())); }
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())); }
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())); }
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())); }
public IActionResult Logout() { _accountService.Logout(HttpContext.Response); return(Ok(SuccessResponse.DefaultOkResponse())); }