Пример #1
0
        public static bool Insertar(Usuarios usuario)
        {
            bool retorno = false;

            using (var db = new LavanderiaDb())
            {
                try
                {
                    if (Buscar(usuario.UsuarioId) == null)
                    {
                        db.Usuario.Add(usuario);
                    }
                    else
                    {
                        db.Entry(usuario).State = System.Data.Entity.EntityState.Modified;
                    }
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
Пример #2
0
        public static bool Insertar(Servicios servicio)
        {
            bool retorno = false;

            using (var db = new LavanderiaDb())
            {
                try
                {
                    if (Buscar(servicio.ServicioId) == null)
                    {
                        db.Servicio.Add(servicio);
                    }
                    else
                    {
                        db.Entry(servicio).State = System.Data.Entity.EntityState.Modified;
                    }
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    //throw;
                }
                return(retorno);
            }
        }
Пример #3
0
        public static bool Eliminar(Servicios servicio)
        {
            bool retorno = false;

            using (var db = new LavanderiaDb())
            {
                try
                {
                    db.Entry(servicio).State = EntityState.Deleted;
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
        public static bool Eliminar(int facturaId)
        {
            bool retorno = false;

            using (var db = new LavanderiaDb())
            {
                try
                {
                    db.FacturaArticulo.RemoveRange(db.FacturaArticulo.Where(fa => fa.FacturaId == facturaId));
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
        public static bool Insertar(List <FacturasArticulos> facturaArticulos)
        {
            bool retorno = false;

            using (var db = new LavanderiaDb())
            {
                try
                {
                    db.FacturaArticulo.AddRange(facturaArticulos);
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
        public static bool Eliminar(int articuloId)
        {
            bool retorno          = false;
            var  servicioArticulo = new ServiciosArticulos();

            using (var db = new LavanderiaDb())
            {
                try
                {
                    db.ServicioArticulo.RemoveRange(db.ServicioArticulo.Where(sa => sa.ArticuloId == articuloId));
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
        public static bool Insertar(List <ServiciosArticulos> servicioArticulo)
        {
            bool retorno = false;

            using (var db = new LavanderiaDb())
            {
                try
                {
                    db.ServicioArticulo.AddRange(servicioArticulo);
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    //throw;
                }
                return(retorno);
            }
        }
Пример #8
0
        public static bool Eliminar(int id)
        {
            bool retorno = false;
            var  factura = new Facturas();

            using (var db = new LavanderiaDb())
            {
                try
                {
                    factura = db.Factura.Find(id);
                    db.Factura.Remove(factura);
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }