public IActionResult Index(CredentialModel cm) { // everything is fine here. No need to change anything here DALPerson pd = new DALPerson(this._configuration); LinkedList <PersonModel> allPerson = pd.GetAllPerson(); ViewBag.AllPerson = allPerson; return(View()); }
public IActionResult UserLogin(CredentialModel cm) { try { // write our regex here var input = cm.Password; var input2 = cm.UserName; // just get the info to display all users DALPerson pd = new DALPerson(this._configuration); LinkedList <PersonModel> allPerson = pd.GetAllPerson(); ViewBag.AllPerson = allPerson; var blackList = new string[] { " ", "'", "\"", "-" }; bool testPassed = true; foreach (string pattern in blackList) { foreach (char character in input) { if (Regex.IsMatch(character.ToString(), pattern)) { testPassed = false; break; } } foreach (char character in input2) { if (Regex.IsMatch(character.ToString(), pattern)) { testPassed = false; break; } } } // everything is fine here. No need to change anything here PersonModel pm = (testPassed) ? pd.CheckLoginCredentials(cm) : null; if (pm == null) { ViewBag.LoginStatus = "Login Failed!!"; } else { ViewBag.LoginStatus = "Login Succeeded"; } return(View("Index")); } catch (Exception ex) { return(View("ErrorPage")); } }
public void Alterar(ModeloPessoa modelo) { if (modelo.Nome.Trim().Length == 0) { throw new Exception("O nome é obrigatório!"); } DALPerson DALobj = new DALPerson(connection); DALobj.Alterar(modelo); }
public IActionResult Page2(Person person) { //inviamo il valore al DB //e facciamo la validazione //string connStr = configuration.GetConnectionString("MyConnString"); DALPerson dp = new DALPerson(configuration); int uID = dp.addUser(person); person.UID = uID; //salviamo l'uid della sessione HttpContext.Session.SetString("uID", uID.ToString()); //scrive sulla sessione string strUID = HttpContext.Session.GetString("uID"); //legge dalla sessione return View(person); }
public ModeloPessoa CarregaModeloPessoa(int codigo) { DALPerson DALobj = new DALPerson(connection); return(DALobj.CarregaModeloPessoa(codigo)); }
public void Excluir(int codigo) { DALPerson DALobj = new DALPerson(connection); DALobj.Excluir(codigo); }