Exemplo n.º 1
0
 public void CadastrarFilme(Filme filme)
 {
     using (var transacao = _context.Database.BeginTransaction())
     {
         try
         {
             _context.Filmes.Add(filme);
             _context.SaveChanges();
             transacao.Commit();
         }
         catch (Exception e)
         {
             throw new Exception(e.Message);
         }
     }
 }
Exemplo n.º 2
0
 public Aluguel AlterarAluguel(Aluguel aluguel)
 {
     using (var transacao = _context.Database.BeginTransaction())
     {
         try
         {
             _context.Alugueis.Update(aluguel);
             _context.SaveChanges();
             transacao.Commit();
             return(aluguel);
         }
         catch (Exception e)
         {
             throw new Exception(e.Message);
         }
     }
 }