Exemplo n.º 1
0
        //Login Using App
        public async Task <JsonResult> LoginApp(string UserName, string Password)
        {
            var result = await SignInManager.PasswordSignInAsync(UserName, Password, false, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                //lưu thông tin dăng nhập
                string UserId = UserManager.FindByName(UserName)?.Id;
                var    uInfo  = _userInfoServices.GetUserInfobyUser(UserId);
                uInfo.LastLoginDate = DateTime.Now;
                uInfo.IsOnline      = true;
                uInfo.FlagLogin     = 1;//app
                //clear
                var wallet = getWalletApp(UserId);
                uInfo.WalletId = wallet.Id;
                _userInfoServices.UpdateUserInfo(uInfo);
                return(Json(new { Status = 1, Wallet = wallet, Info = _userInfoServices.getUserInfoByStore(UserId).FirstOrDefault() }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { Status = 0, Wallet = new Wallet() }, JsonRequestBehavior.AllowGet));
        }