Exemplo n.º 1
0
        public static bool Guardar(List <FacturasDetalles> detalles)
        {
            bool resultado = false;

            using (var conexion = new MoviesExtremeDb())
            {
                try
                {
                    foreach (FacturasDetalles detail in detalles)
                    {
                        resultado = Guardar(detail);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Exemplo n.º 2
0
        public static bool Guardar(EncabezadoDetalle factura)
        {
            bool resultado = false;

            using (var db = new MoviesExtremeDb())
            {
                try
                {
                    db.Factura.Add(factura.Encabezado);
                    if (db.SaveChanges() > 0)
                    {
                        resultado = BLL.FacturasDetallesBLL.Guardar(factura.Detalle);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Exemplo n.º 3
0
        public static bool Modificar(EncabezadoDetalle factura)
        {
            bool resultado = false;

            using (var conexion = new MoviesExtremeDb())
            {
                try
                {
                    conexion.Entry(factura.Encabezado).State = EntityState.Modified;
                    if (conexion.SaveChanges() > 0)
                    {
                        resultado = FacturasDetallesBLL.Modificar(factura.Detalle);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Exemplo n.º 4
0
        public static bool Eliminar(EncabezadoDetalle factura)
        {
            bool resultado = false;

            using (var conexion = new MoviesExtremeDb())
            {
                try
                {
                    if (BLL.FacturasDetallesBLL.Eliminar(factura.Detalle))
                    {
                        conexion.Entry(factura.Encabezado).State = EntityState.Deleted;
                        resultado = conexion.SaveChanges() > 0;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }