Guest User

Untitled

a guest
Jul 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. //String Conexao
  2. <add name="AAGAPEContext" connectionString="Data Source=APSISC07\SQL;Initial Catalog=AAGAPE;Integrated Security=False;User ID=Sa;Password=%Cegsecurity16;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False" providerName="System.Data.SqlClient" />
  3.  
  4. //Action com Filtro
  5. ActionResult Index(String nome)
  6. {
  7. var cadastro = from c in db.Cadastro
  8. select c;
  9. if (!String.IsNullOrEmpty(nome))
  10. {
  11. cadastro = cadastro.Where(x => x.Nome.Contains(nome));
  12. }
  13.  
  14. return View(cadastro.ToList());
  15. }
  16.  
  17. //Campo Razor Filtro
  18. @using (Html.BeginForm())
  19. {
  20. <p>
  21. Localizar po Nome: @Html.TextBox("Nome")
  22. <input type="submit" value="Search" class="btn btn-success" />
  23. </p>
  24. }
  25.  
  26. //Create Table com chave estrangeira
  27.  
  28. CREATE TABLE TB_ALUNO(
  29.  
  30. ID_ALUNO INT IDENTITY(1,1) PRIMARY KEY,
  31. NM_NOME VARCHAR(100),
  32. ID_CURSO INT FOREIGN KEY REFERENCES TB_CURSO(ID_CURSO)
  33.  
  34. )
Add Comment
Please, Sign In to add comment