public IActionResult Edit([FromQuery] int AccId) { var acc = _IAcc.GetAccount(AccId); if (acc != null) { return(View(acc)); } return(RedirectToAction("index")); }
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); }
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); }
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()); } }
public Account GetAccount(Guid accId) { Account account = TransformationsFromRepo.From_AccInfo_To_Account(_accRepo.GetAccount(accId)); return(account); }