public IList <Relatorio> Delete(long Id)
        {
            IList <Relatorio> relatorioList = null;

            using (RelatorioDataBaseContext context = new RelatorioDataBaseContext(RelatorioDataBaseContext.ConnectionString))
            {
                try
                {
                    IQueryable <Relatorio> query =
                        from c in context.RelatorioTable
                        where c.Id == Id
                        select c;
                    Relatorio relatorioToDelete = query.FirstOrDefault();
                    context.RelatorioTable.DeleteOnSubmit(relatorioToDelete);
                    context.SubmitChanges();
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.StackTrace);
                    Debug.WriteLine(e.Message);
                    MessageBox.Show("PROBLEMA NA LISTAGEM POR DATA");
                }
            }

            return(relatorioList);
        }
 public void Add(Relatorio relatorio)
 {
     using (RelatorioDataBaseContext context =
                new RelatorioDataBaseContext(RelatorioDataBaseContext.ConnectionString))
     {
         try
         {
             context.RelatorioTable.InsertOnSubmit(relatorio);
             context.SubmitChanges();
         }
         catch (Exception e)
         {
             Debug.WriteLine(e.StackTrace);
             Debug.WriteLine(e.Message);
             MessageBox.Show("PROBLEMA AO ADICIONAR! ");
         }
     }
 }