コード例 #1
0
        public ActionResult Create()
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

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

                WalletBO wallet = new WalletBO();
                wallet.xPriv = "Cardano private key";
                wallet.xPub  = "Cardano public key";

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

                return(BadRequest(_apiResponse));
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
0
        public ActionResult Profile()
        {
            UserResponseBO _apiResponse = new UserResponseBO();

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

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

                _apiResponse.UserInfo = userInfo;

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

            return(Ok(_apiResponse));
        }
コード例 #4
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));
            }
        }
コード例 #5
0
        public void SaveLoginDetails(TblEmployeeMaster master)
        {
            if (master.EmployeeId > 0)
            {
                var entity = this.ktConContext.TblUserInfo.FirstOrDefault(item => item.Username == master.UserId.ToString() && item.Userpassword == master.Password);

                if (entity != null)
                {
                    entity.Userpassword = master.Password;
                    entity.Username     = master.UserId;
                    // entity.UserType = master.EmployeeId.ToString();
                    ktConContext.TblUserInfo.Update(entity);
                    ktConContext.SaveChanges();
                }
            }
            else
            {
                TblUserInfo custransList = new TblUserInfo()
                {
                    Userpassword = master.Password,
                    // UserType = master.EmployeeId.ToString(),
                    Username = master.UserId
                };
                this.RepositoryContext.Set <TblUserInfo>().Add(custransList);
                this.RepositoryContext.SaveChanges();
            }
        }
コード例 #6
0
        public ActionResult Receive([FromBody] WalletRecieveBO walletRecieve)
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

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

                WalletRecieveBO wallet = new WalletRecieveBO();
                wallet.AddressString = "Cardano wallet address";
                wallet.CallbackUrl   = "Your callback url";

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

                return(BadRequest(_apiResponse));
            }
        }
コード例 #7
0
        public bool Create(UserBO userBO)
        {
            using (var db = new dbGSCasinoContext())
            {
                using (var transaction = db.Database.BeginTransaction())
                {
                    UserInfoRepository userInfoRepository = new UserInfoRepository();
                    TblUserInfo        userInfo           = userInfoRepository.Create(userBO, db);

                    UserAuthRepository userAuthRepository = new UserAuthRepository();
                    TblUserAuth        userAuth           = userAuthRepository.Create(userBO, userInfo, db);

                    UserRoleRepository userRoleRepository = new UserRoleRepository();
                    userRoleRepository.Create(userAuth, db);

                    // CREATE USER WALLETS
                    UserWalletAppService userWallet = new UserWalletAppService();
                    userWallet.Create(userAuth, db);

                    transaction.Commit();

                    return(true);
                }
            }
        }
コード例 #8
0
        public ActionResult GetWallet([FromBody] WalletBO wallet)
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

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

                List <WalletBO> walletBOs = new List <WalletBO>();
                WalletBO        walletBO  = new WalletBO();
                wallet.xPriv          = "Cardano private key";
                wallet.xPub           = "Cardano public key";
                wallet.Balance.Amount = 10m;

                walletBOs.Add(walletBO);

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

                return(BadRequest(_apiResponse));
            }
        }
コード例 #9
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"));
            }
        }
コード例 #10
0
        public TblUserInfo Get(TblUserAuth userAuth)
        {
            using (var db = new Minny_Casino_AffiliateContext())
            {
                using (var transaction = db.Database.BeginTransaction())
                {
                    UserInfoRepository userInfoRepository = new UserInfoRepository();
                    TblUserInfo        userInfo           = userInfoRepository.Get(userAuth, db);

                    return(userInfo);
                }
            }
        }
コード例 #11
0
        public TblUserInfo Get(TblUserAuth userAuth)
        {
            using (var db = new dbWorldCCityContext())
            {
                using (var transaction = db.Database.BeginTransaction())
                {
                    UserInfoRepository userInfoRepository = new UserInfoRepository();
                    TblUserInfo        userInfo           = userInfoRepository.Get(userAuth, db);

                    return(userInfo);
                }
            }
        }
コード例 #12
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");
            }
        }
コード例 #13
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"));
            }
        }
コード例 #14
0
        public TblUserInfo Create(UserBO userBO, dbGSCasinoContext db)
        {
            TblUserInfo _userInfo = new TblUserInfo();

            _userInfo.FirstName       = userBO.FirstName;
            _userInfo.LastName        = userBO.LastName;
            _userInfo.PhoneNumber     = userBO.PhoneNumber;
            _userInfo.Email           = userBO.Email;
            _userInfo.Dob             = userBO.Dob;
            _userInfo.CountryIsoCode2 = userBO.CountryIsoCode2;
            _userInfo.Gender          = userBO.Gender;
            _userInfo.Uid             = new Guid().ToString();
            _userInfo.IsEnabled       = true;

            db.TblUserInfo.Add(_userInfo);
            db.SaveChanges();

            return(_userInfo);
        }
コード例 #15
0
        public TblUserInfo Create(UserBO userBO, Minny_Casino_AffiliateContext db)
        {
            TblUserInfo _userInfo = new TblUserInfo();

            _userInfo.FirstName       = userBO.FirstName;
            _userInfo.LastName        = userBO.LastName;
            _userInfo.PhoneNumber     = userBO.PhoneNumber;
            _userInfo.Email           = userBO.Email;
            _userInfo.Dob             = userBO.Dob;
            _userInfo.CountryIsoCode2 = userBO.CountryIsoCode2;
            _userInfo.Gender          = userBO.Gender;
            _userInfo.Uid             = new Guid().ToString();
            _userInfo.IsEnabled       = true;
            _userInfo.EmailStatus     = (short)EmailStatus.Unverified;

            db.TblUserInfo.Add(_userInfo);
            db.SaveChanges();

            return(_userInfo);
        }
コード例 #16
0
        public ActionResult GetBalance([FromBody] AddressBO address)
        {
            try
            {
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

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

                AddressBO addressBO = new AddressBO();
                addressBO.AddressString = address.AddressString;
                addressBO.Value.Amount  = 10m;

                return(Ok(addressBO));
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #17
0
        public UserAuthResponse Authenticate(UserBO userBO)
        {
            using (var db = new dbWorldCCityContext())
            {
                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);

                UserAuthResponse userAuthResponse = new UserAuthResponse();

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

                return(userAuthResponse);
            }
        }
コード例 #18
0
        public ActionResult GetServerBalance()
        {
            try
            {
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

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

                ServerWalletBO serverWallet = new ServerWalletBO();
                serverWallet.ServerBalance          = 10000;
                serverWallet.ServerDeposit          = 2000;
                serverWallet.TransferedToColdWallet = 30m;

                return(Ok(serverWallet));
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #19
0
        public ActionResult History([FromBody] WalletBO wallet)
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

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

                List <WalletTransactionBO> walletTransactions = new List <WalletTransactionBO>();

                WalletTransactionBO walletTransaction = new WalletTransactionBO();
                walletTransaction.From   = "from wallet address..";
                walletTransaction.To     = "to wallet address..";
                walletTransaction.Amount = 100f;

                walletTransactions.Add(walletTransaction);

                walletTransaction.From   = "from wallet address..";
                walletTransaction.To     = "to wallet address..";
                walletTransaction.Amount = 100f;

                walletTransactions.Add(walletTransaction);

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

                return(BadRequest(_apiResponse));
            }
        }
コード例 #20
0
        public TblUserInfo Get(TblUserAuth userAuth, Minny_Casino_AffiliateContext db)
        {
            var _qUi = from a in db.TblUserInfo
                       where a.Id == userAuth.UserInfoId
                       select new TblUserInfo
            {
                FirstName       = a.FirstName,
                LastName        = a.LastName,
                Dob             = a.Dob,
                Email           = a.Email,
                PhoneNumber     = a.PhoneNumber,
                Gender          = a.Gender,
                Uid             = a.Uid,
                EmailStatus     = a.EmailStatus,
                CreatedOn       = a.CreatedOn,
                CountryIsoCode2 = a.CountryIsoCode2,
                CompanyName     = a.CompanyName
            };

            TblUserInfo _tblUserInfo = _qUi.FirstOrDefault();

            return(_tblUserInfo);
        }
コード例 #21
0
        public TblUserAuth Create(UserBO userBO, TblUserInfo userInfo, dbWorldCCityContext db)
        {
            TblUserAuth _userAuth = new TblUserAuth();

            byte[] _passwordByte = Encoding.ASCII.GetBytes(userBO.PasswordString);
            byte[] _hashPasswordByte;
            SHA512 shaM = new SHA512Managed();

            _hashPasswordByte = shaM.ComputeHash(_passwordByte);
            string base64Password = System.Convert.ToBase64String(_hashPasswordByte);

            _userAuth.UserName       = userBO.UserName;
            _userAuth.PasswordByte   = _hashPasswordByte;
            _userAuth.IsTempPassword = false;
            _userAuth.IsEnabled      = true;
            _userAuth.LoginStatus    = 1;
            _userAuth.UserInfoId     = userInfo.Id;

            db.TblUserAuth.Add(_userAuth);

            db.SaveChanges();

            return(_userAuth);
        }
コード例 #22
0
        public TblUserInfo SearchLogin([FromBody] TblUserInfo user)
        {
            var login = this._repoWrapper.Product.SearchLogin(user).FirstOrDefault();

            if (login.UserId <= 0)
            {
                return(null);
            }
            var tokenHandler    = new JwtSecurityTokenHandler();
            var key             = System.Text.Encoding.ASCII.GetBytes(_appSettings.Secret);
            var tokenDescriptor = new SecurityTokenDescriptor
            {
                Subject = new ClaimsIdentity(new Claim[]
                {
                    new Claim(ClaimTypes.Name, login.Username.ToString())
                }),
                Expires            = DateTime.UtcNow.AddDays(7),
                SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
            };
            var token = tokenHandler.CreateToken(tokenDescriptor);

            login.Token = tokenHandler.WriteToken(token);
            return(login);
        }