Exemplo n.º 1
0
        public IActionResult Edit([FromQuery] int AccId)
        {
            var acc = _IAcc.GetAccount(AccId);

            if (acc != null)
            {
                return(View(acc));
            }
            return(RedirectToAction("index"));
        }
Exemplo n.º 2
0
        public async void GetMyAccount(NetworkStream stream, string content)
        {
            AccountModel dummy    = JsonSerializer.Deserialize <AccountModel>(content);
            string       username = dummy.Username;
            string       password = dummy.Password;

            _account = await _accountRepo.GetAccount(username, password);

            string reply = JsonSerializer.Serialize(_account);

            byte[] bytesWrite = Encoding.ASCII.GetBytes(reply);
            stream.Write(bytesWrite, 0, bytesWrite.Length);
        }
Exemplo n.º 3
0
        public bool Auth(string account, string password)
        {
            var result      = false;
            var accountList = _accountRepo.GetAccount();

            foreach (var adminAccount in accountList)
            {
                if (account != adminAccount)
                {
                    continue;
                }
                result = true;
                break;
            }
            if (account == "steven" && password == "123456")
            {
                result = true;
            }
            return(result);
        }
Exemplo n.º 4
0
        public ActionResult Login(AdminAccount model)
        {
            if (ModelState.IsValid)
            {
                account = accountRepo.GetAccount(model.UserName, model.Password);
            }
            if (account != null)
            {
                FormsAuthentication.SetAuthCookie(account.UserName, false);

                Session["Loggedin_admin"] = account;

                return(RedirectToAction("Index", "Admin"));
            }
            else
            {
                ModelState.AddModelError("login-error", "Incorrect username/password");
                return(View());
            }
        }
Exemplo n.º 5
0
        public Account GetAccount(Guid accId)
        {
            Account account = TransformationsFromRepo.From_AccInfo_To_Account(_accRepo.GetAccount(accId));

            return(account);
        }