Exemple #1
0
 public void eliminar()
 {
     try
     {
         using (var ctx = new tekusContext())
         {
             ctx.Entry(this).State = EntityState.Deleted;
             ctx.SaveChanges();
         }
     }
     catch (Exception E)
     {
         throw;
     }
 }
Exemple #2
0
        public List <cliente> Listar()
        {
            var clientes = new List <cliente>();

            try
            {
                using (var ctx = new tekusContext())
                {
                    clientes = ctx.cliente.ToList();
                }
            }
            catch (Exception E)
            {
                throw;
            }

            return(clientes);
        }
Exemple #3
0
        public cliente verCliente(int id)
        {
            var cliente = new cliente();

            try
            {
                using (var ctx = new tekusContext())
                {
                    cliente = ctx.cliente.Include("servicio")
                              .Include("servicio.pais")
                              .Where(x => x.id == id)
                              .SingleOrDefault();
                }
            }
            catch (Exception E)
            {
                throw;
            }

            return(cliente);
        }
Exemple #4
0
        public void salvarCliente()
        {
            try
            {
                using (var ctx = new tekusContext())
                {
                    if (this.id > 0)
                    {
                        ctx.Entry(this).State = EntityState.Modified;
                    }
                    else
                    {
                        ctx.Entry(this).State = EntityState.Added;
                    }

                    ctx.SaveChanges();
                }
            }
            catch (Exception E)
            {
                throw;
            }
        }