Exemplo n.º 1
0
 public static List <Tarefa> Retornar_Tarefas()
 {
     try
     {
         ListaTarefasBD db = new ListaTarefasBD();
         return(db.Tarefa.ToList());
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
 public static Tarefa Pesquisar_Tarefa(int id)
 {
     try
     {
         ListaTarefasBD db = new ListaTarefasBD();
         return(db.Tarefa.Find(id));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 3
0
        public static void Inserir_Tarefa(Tarefa t)
        {
            try
            {
                ListaTarefasBD db = new ListaTarefasBD();
                db.Tarefa.Add(t);

                db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        public static void Remover_Tarefa(Tarefa t)
        {
            try
            {
                ListaTarefasBD db      = new ListaTarefasBD();
                Tarefa         apagada = db.Tarefa.Find(t.Id);
                db.Tarefa.Remove(apagada);

                db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 5
0
        public static void Editar_Tarefa(Tarefa t)
        {
            try
            {
                ListaTarefasBD db             = new ListaTarefasBD();
                Tarefa         tarefa_editada = db.Tarefa.Find(t.Id);

                tarefa_editada.Titulo     = t.Titulo;
                tarefa_editada.Finalizada = t.Finalizada;

                db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }