Пример #1
0
    public void cadastrarSoftware(
        TextBox txtNome,
        TextBox txtDescricao,
        TextBox txtInterface,
        TextBox txtVersao)
    {
        using (DataClassesDataContext banco = new DataClassesDataContext())
        {
            tb_Software novoCadastro = new tb_Software();

            novoCadastro.sf_nome      = txtNome.Text;
            novoCadastro.sf_descricao = txtDescricao.Text;
            novoCadastro.sf_interface = txtInterface.Text;
            novoCadastro.sf_versao    = txtVersao.Text;

            banco.tb_Softwares.InsertOnSubmit(novoCadastro);
            banco.SubmitChanges();
        }
    }
Пример #2
0
    public void editarSofware(int idSoftware,
                              TextBox txtNome,
                              TextBox txtDescricao,
                              TextBox txtInterface,
                              TextBox txtVersao)
    {
        using (DataClassesDataContext banco = new DataClassesDataContext())
        {
            tb_Software resultado = (from p in banco.tb_Softwares
                                     where p.id_Software.Equals(idSoftware)
                                     select p).SingleOrDefault();


            resultado.sf_nome      = txtNome.Text;
            resultado.sf_descricao = txtDescricao.Text;
            resultado.sf_interface = txtInterface.Text;
            resultado.sf_versao    = txtVersao.Text;

            banco.SubmitChanges();
        }
    }