public string Salvar(Tarefa entity) { TesteSqliteContext contexto = new TesteSqliteContext(); using (DbContextTransaction transacao = TesteSqliteTransaction.CreateDbContextTransaction(contexto)) { if (entity.Id == 0) { _mensagem = new TarefaRepository(contexto).Incluir(entity); } else { _mensagem = new TarefaRepository(contexto).Alterar(entity); } if (_mensagem == "") { transacao.Commit(); } else { transacao.Rollback(); } } return(_mensagem); }
public DatabaseRepository(TesteSqliteContext context = null) { _db = context == null ? new TesteSqliteContext() : context; }
public TarefaRepository(TesteSqliteContext context = null) { _repository = new Repository <Tarefa>(context == null ? new TesteSqliteContext() : context); }