Example #1
0
        public static bool Guardar(Tickets ticket)
        {
            bool retorno = false;

            try
            {
                using (var db = new BancaDB())
                {
                    if (Buscar(ticket.IdTicket) == null)
                    {
                        db.tickets.Add(ticket);
                    }
                    else
                    {
                        db.Entry(ticket).State = EntityState.Modified;
                    }

                    foreach (var detalles in ticket.detalles)
                    {
                        db.Entry(detalles).State = EntityState.Unchanged;
                    }
                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Example #2
0
        public static void Modificar(Usuarios usuario)
        {
            var db = new BancaDB();

            db.Entry(usuario).State = EntityState.Modified;
            db.SaveChanges();
        }
        public static void Modificar(Bancas banca)
        {
            var db = new BancaDB();

            db.Entry(banca).State = EntityState.Modified;
            db.SaveChanges();
        }
Example #4
0
        public static void Modificar(Loterias loteria)
        {
            var db = new BancaDB();

            db.Entry(loteria).State = EntityState.Modified;
            db.SaveChanges();
        }
Example #5
0
        public static bool Eliminar(int ID)
        {
            bool     retorno = false;
            var      db      = new BancaDB();
            Usuarios usuario = Buscar(ID);

            if (usuario != null)
            {
                db.Entry(usuario).State = EntityState.Deleted;
                db.SaveChanges();
                retorno = true;
            }
            return(retorno);
        }
        public static bool Eliminar(int Id)
        {
            bool   retorno = false;
            var    db      = new BancaDB();
            Bancas banca   = Buscar(Id);

            if (banca != null)
            {
                db.Entry(banca).State = EntityState.Deleted;
                db.SaveChanges();
                retorno = true;
            }
            return(retorno);
        }
Example #7
0
        public static bool Eliminar(int ID)
        {
            bool     retorno  = false;
            var      db       = new BancaDB();
            Loterias loterias = Buscar(ID);

            if (loterias != null)
            {
                db.Entry(loterias).State = EntityState.Deleted;
                db.SaveChanges();
                retorno = true;
            }
            return(retorno);
        }