예제 #1
0
 /// <summary>
 /// Edita um pacote
 /// </summary>
 /// <param name="pacote">pacote a ser Editado</param>
 /// <returns>Retorna o pacote editado</returns>
 public PacoteDominio Editar(PacoteDominio pacote)
 {
     try
     {
         using (CodeTurContext ctx = new CodeTurContext())
         {
             ctx.Entry <PacoteDominio>(pacote).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
             ctx.SaveChanges();
             return(pacote);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #2
0
        public bool ExcluirPacote(int id)
        {
            try
            {
                using (CodeTurContext ctx = new CodeTurContext())
                {
                    var pacote = BuscarPorId(id);

                    ctx.Entry <PacoteDominio>(pacote).State = Microsoft.EntityFrameworkCore.EntityState.Deleted;
                    ctx.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #3
0
 public void Alterar(Usuario usuario)
 {
     _context.Entry(usuario).State = EntityState.Modified;
     _context.SaveChanges();
 }
예제 #4
0
 public void Alterar(Pacote pacote)
 {
     _context.Entry(pacote).State = EntityState.Modified;
     _context.SaveChanges();
 }
예제 #5
0
 public void Alterar(Pacote pacote)
 {
     _context.Entry(pacote).State = EntityState.Modified;
 }
예제 #6
0
 public void Alterar(Usuario usuario)
 {
     _context.Entry(usuario).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     _context.SaveChanges();
 }