Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //String Conexao
- <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" />
- //Action com Filtro
- ActionResult Index(String nome)
- {
- var cadastro = from c in db.Cadastro
- select c;
- if (!String.IsNullOrEmpty(nome))
- {
- cadastro = cadastro.Where(x => x.Nome.Contains(nome));
- }
- return View(cadastro.ToList());
- }
- //Campo Razor Filtro
- @using (Html.BeginForm())
- {
- <p>
- Localizar po Nome: @Html.TextBox("Nome")
- <input type="submit" value="Search" class="btn btn-success" />
- </p>
- }
- //Create Table com chave estrangeira
- CREATE TABLE TB_ALUNO(
- ID_ALUNO INT IDENTITY(1,1) PRIMARY KEY,
- NM_NOME VARCHAR(100),
- ID_CURSO INT FOREIGN KEY REFERENCES TB_CURSO(ID_CURSO)
- )
Add Comment
Please, Sign In to add comment