Exemple #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);
        }
Exemple #2
0
        public static void Modificar(Usuarios usuario)
        {
            var db = new BancaDB();

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

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

            db.Entry(banca).State = EntityState.Modified;
            db.SaveChanges();
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #8
0
        public static bool Guardar(Usuarios usuario)
        {
            bool retorno = false;

            try
            {
                BancaDB db = new BancaDB();
                db.usuarios.Add(usuario);
                db.SaveChanges();
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }

            return(retorno);
        }
        public static bool Guardar(Detalles detalle)
        {
            bool retorno = false;

            try
            {
                var db = new BancaDB();
                db.detalles.Add(detalle);
                db.SaveChanges();

                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
        public static bool Guardar(Bancas banca)
        {
            bool retorno = false;

            try
            {
                BancaDB db = new BancaDB();
                db.bancas.Add(banca);
                db.SaveChanges();
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }

            return(retorno);
        }
Exemple #11
0
        public static bool Guardar(Loterias loteria)
        {
            bool retorno = false;

            try
            {
                BancaDB db = new BancaDB();
                db.loterias.Add(loteria);
                db.SaveChanges();
                retorno = true;
            }
            catch (Exception e)
            {
                throw e;
            }

            return(retorno);
        }
        public static bool Guardar(TicketsDetalles lista)
        {
            bool retorno = false;

            try
            {
                using (var db = new BancaDB())
                {
                    db.ticketsDetalles.Add(lista);
                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
        public static bool Eliminar(int Id)
        {
            bool retorno = false;

            try
            {
                using (BancaDB db = new BancaDB())
                {
                    Detalles detalle = (from d in db.detalles where d.IdDetalle == Id select d).FirstOrDefault();
                    db.detalles.Remove(detalle);
                    db.SaveChanges();
                    retorno = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Exemple #14
0
        public static bool Eliminar(int Id)
        {
            bool retorno = false;

            try
            {
                using (BancaDB db = new BancaDB())
                {
                    Tickets ticket = (from c in db.tickets where c.IdTicket == Id select c).FirstOrDefault();
                    db.tickets.Remove(ticket);
                    db.SaveChanges();
                    retorno = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
        public static bool Editar(int Id, Detalles detalles)
        {
            bool retorno = false;

            try
            {
                using (var db = new BancaDB())
                {
                    Detalles detalle = db.detalles.Find(Id);

                    detalle.Jugada = detalles.Jugada;
                    detalle.Precio = detalles.Precio;
                    detalle.Tipo   = detalles.Tipo;

                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }