Example #1
0
        public ActionResult BackupFunds()
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

                UserResponseBO _apiResponse = new UserResponseBO();

                _apiResponse.HttpStatusCode = "200";
                _apiResponse.Message        = "Transaction successful";
                _apiResponse.Status         = "Success";

                return(Ok(_apiResponse));
            }
            catch (Exception ex)
            {
                ApiResponseBO _apiResponse = new ApiResponseBO();
                _apiResponse.HttpStatusCode = "400";
                _apiResponse.Message        = ex.Message;
                _apiResponse.Status         = "Error";

                return(BadRequest(_apiResponse));
            }
        }
Example #2
0
        public ActionResult Send([FromBody] WalletTransactionBO walletTransaction)
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

                UserAppService userAppService = new UserAppService();
                TblUserInfo    userInfo       = userAppService.Get(userAuth);

                UserResponseBO _apiResponse = new UserResponseBO();

                TransactionAppService transactionAppService = new TransactionAppService();
                transactionAppService.CreateWithdrawalRequest(walletTransaction);

                _apiResponse.HttpStatusCode = "200";
                _apiResponse.Message        = "Transaction successful";
                _apiResponse.Status         = "Success";

                return(Ok(_apiResponse));
            }
            catch (Exception ex)
            {
                ApiResponseBO _apiResponse = new ApiResponseBO();
                _apiResponse.HttpStatusCode = "400";
                _apiResponse.Message        = ex.Message;
                _apiResponse.Status         = "Error";

                return(BadRequest(_apiResponse));
            }
        }
Example #3
0
        public ActionResult UpdateWithdrawalRequest(TransactionQueryBO transactionQuery)
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

                UserResponseBO        _apiResponse          = new UserResponseBO();
                TransactionAppService transactionAppService = new TransactionAppService();
                transactionAppService.UpdateWithdrawalRequest(transactionQuery);

                _apiResponse.HttpStatusCode = "200";
                _apiResponse.Message        = "Transaction successful";
                _apiResponse.Status         = "Success";

                return(Ok(_apiResponse));
            }
            catch (Exception ex)
            {
                ApiResponseBO _apiResponse = new ApiResponseBO();
                _apiResponse.HttpStatusCode = "400";
                _apiResponse.Message        = ex.Message;
                _apiResponse.Status         = "Error";

                return(BadRequest(_apiResponse));
            }
        }
Example #4
0
        public async Task <IActionResult> Index()
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                SessionBO         session           = sessionController.GetSession(HttpContext.Session);

                ApiRequest apiRequest = new ApiRequest();
                ResponseBO _res       = await apiRequest.GetAsync("User/Profile", session.SessionCookies);

                UserResponseBO apiResponse = JsonConvert.DeserializeObject <UserResponseBO>(_res.ResponseResult);

                TblUserInfo userInfo = apiResponse.UserInfo;
                TblUserAuth userAuth = apiResponse.UserAuth;

                if (apiResponse.HttpStatusCode == "200")
                {
                    ActivityVM activityVM = new ActivityVM();
                    activityVM.Fullname = String.Format("{0} {1}", userInfo.FirstName, userInfo.LastName);
                    activityVM.Username = userAuth.UserName;

                    return(View(activityVM));
                }
                else
                {
                    return(RedirectToAction("Login", "Home"));
                }
            }
            catch (System.Exception e)
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
Example #5
0
        public ActionResult Wallet()
        {
            UserWalletAppService userWalletAppService = new UserWalletAppService();
            UserResponseBO       _apiResponse         = new UserResponseBO();

            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

                _apiResponse.UserWallet = userWalletAppService.GetBO(userAuth);

                _apiResponse.HttpStatusCode = "200";
                _apiResponse.Message        = "UserWallet GET";
                _apiResponse.Status         = "Success";
            }
            catch (Exception ex)
            {
                _apiResponse.HttpStatusCode = "500";
                _apiResponse.Message        = ex.Message;
                _apiResponse.Status         = "Error";
            }

            return(Ok(_apiResponse));
        }
Example #6
0
        public UserResponseBO Authenticate(UserBO userBO)
        {
            using (var db = new dbGSCasinoContext())
            {
                UserAuthRepository userAuthRepository = new UserAuthRepository();
                TblUserAuth        userAuth           = userAuthRepository.Get(userBO, db);

                UserInfoRepository userInfoRepository = new UserInfoRepository();
                TblUserInfo        userInfo           = userInfoRepository.Get(userAuth, db);

                UserWalletRepository userWalletRepository = new UserWalletRepository();
                List <UserWalletBO>  userWallet           = userWalletRepository.GetBO(userAuth, db);

                UserRoleRepository userRoleRepository = new UserRoleRepository();
                TblUserRole        userRole           = userRoleRepository.Get(userAuth, db);

                UserResponseBO userAuthResponse = new UserResponseBO();

                userAuthResponse.UserInfo   = userInfo;
                userAuthResponse.UserWallet = userWallet;
                userAuthResponse.UserAuth   = userAuth;
                userAuthResponse.UserRole   = userRole;

                return(userAuthResponse);
            }
        }
Example #7
0
        public async Task <IActionResult> LoginAsync([FromBody] UserBO userBO)
        {
            try
            {
                ApiRequest apiRequest = new ApiRequest();
                ResponseBO _res       = await apiRequest.PostAsync("User/Authenticate", userBO);

                UserResponseBO apiResponse = JsonConvert.DeserializeObject <UserResponseBO>(_res.ResponseResult);

                if (apiResponse.HttpStatusCode == "200")
                {
                    SessionController sessionController = new SessionController();
                    sessionController.CreateSession(apiResponse, _res.ResponseCookies, HttpContext.Session);

                    TblUserInfo tblUserInfo = apiResponse.UserInfo;
                    TblUserAuth tblUserAuth = apiResponse.UserAuth;
                    TblUserRole tblUserRole = apiResponse.UserRole;



                    //if (tblUserRole.AccessRole.Equals("Admin") || tblUserRole.AccessRole.Equals("SuperAdmin"))
                    //{
                    //    apiResponse.RedirectUrl = "/Admin/";
                    //}
                    //else
                    //{
                    //    apiResponse.RedirectUrl = "/Dashboard/";
                    //}
                    apiResponse.RedirectUrl = "/Dashboard/";
                    return(Ok(apiResponse));
                }
                else
                {
                    apiResponse.RedirectUrl = "/User/Login/Failed";
                    return(BadRequest(apiResponse));
                }
            }
            catch (System.Exception e)
            {
                UserResponseBO apiResponse = new UserResponseBO();
                apiResponse.RedirectUrl = "/User/Login/Failed";
                apiResponse.Message     = e.Message;
                return(BadRequest(apiResponse));
                //return Redirect("~/User/Login/Failed");
            }
        }
Example #8
0
        // GET: /<controller>/
        public async Task <IActionResult> Index()
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                SessionBO         session           = sessionController.GetSession(HttpContext.Session);

                ApiRequest apiRequest = new ApiRequest();
                ResponseBO _res       = await apiRequest.GetAsync("User/Profile", session.SessionCookies);

                UserResponseBO apiResponse = JsonConvert.DeserializeObject <UserResponseBO>(_res.ResponseResult);

                TblUserInfo userInfo = apiResponse.UserInfo;
                TblUserAuth userAuth = apiResponse.UserAuth;

                _res = await apiRequest.GetAsync("User/Wallet", session.SessionCookies);

                apiResponse = JsonConvert.DeserializeObject <UserResponseBO>(_res.ResponseResult);

                List <UserWalletBO> userWallets = apiResponse.UserWallet;

                if (apiResponse.HttpStatusCode == "200")
                {
                    DashboardVM dashboardVM = new DashboardVM();
                    dashboardVM.Fullname          = String.Format("{0} {1}", userInfo.FirstName, userInfo.LastName);
                    dashboardVM.TotalCustomer     = (int)userWallets.Find(i => i.WalletCode == "DLN").Balance;
                    dashboardVM.TotalFirstDeposit = (int)userWallets.Find(i => i.WalletCode == "IDC").Balance;
                    dashboardVM.TotalHits         = (int)userWallets.Find(i => i.WalletCode == "HIT").Balance;
                    dashboardVM.TotalIncome       = (int)userWallets.Find(i => i.WalletCode == "TIN").Balance;
                    dashboardVM.TotalSignUps      = (int)userWallets.Find(i => i.WalletCode == "TCR").Balance;
                    dashboardVM.Username          = userAuth.UserName;

                    return(View(dashboardVM));
                }
                else
                {
                    return(RedirectToAction("Login", "Home"));
                }
            }
            catch (System.Exception e)
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
Example #9
0
        public ActionResult Authenticate([FromBody] UserBO userBO)
        {
            UserAppService userAppService = new UserAppService();
            UserResponseBO _apiResponse   = new UserResponseBO();

            if (ModelState.IsValid)
            {
                try
                {
                    UserResponseBO userAuthResponse = userAppService.Authenticate(userBO);

                    _apiResponse.UserInfo   = userAuthResponse.UserInfo;
                    _apiResponse.UserWallet = userAuthResponse.UserWallet;
                    _apiResponse.UserRole   = userAuthResponse.UserRole;

                    // SET SESSIONS
                    SessionController sessionController = new SessionController();
                    sessionController.CreateSession(userAuthResponse, HttpContext.Session);


                    _apiResponse.HttpStatusCode = "200";
                    _apiResponse.Message        = "User successfully authenticated";
                    _apiResponse.Status         = "Success";

                    return(Ok(_apiResponse));
                }
                catch (Exception ex)
                {
                    _apiResponse.HttpStatusCode = "500";
                    _apiResponse.Message        = ex.Message;
                    _apiResponse.Status         = "Error";

                    return(Ok(_apiResponse));
                }
            }
            else
            {
                _apiResponse.HttpStatusCode = "500";
                _apiResponse.Message        = "Please input the required credentials";
                _apiResponse.Status         = "Error";

                return(Ok(_apiResponse));
            }
        }
Example #10
0
 public bool CreateSession([FromBody] UserResponseBO userAuthResponse, ISession session)
 {
     session.SetString(USER_SESSION, JsonConvert.SerializeObject(userAuthResponse.UserAuth));
     return(true);
 }
Example #11
0
 public bool CreateSession([FromBody] UserResponseBO UserResponseBO, CookieCollection ResponseCookies, ISession session)
 {
     session.SetString(USER_SESSION, JsonConvert.SerializeObject(UserResponseBO.UserInfo));
     session.SetString(USER_SESSION_COOKIE, JsonConvert.SerializeObject(ResponseCookies));
     return(true);
 }