コード例 #1
0
 public static bool Guardar(Autores nuevo)
 {
     using (var db = new DetalleDb())
     {
         try
         {
             if (Buscar(nuevo.AutoresId) == null)
             {
                 db.autores.Add(nuevo);
                 db.SaveChanges();
                 return(true);
             }
             else
             {
                 db.Entry(nuevo).State = System.Data.Entity.EntityState.Unchanged;
                 db.SaveChanges();
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
         return(false);
     }
 }
コード例 #2
0
        public static bool Guardar(Libros nuevo)
        {
            using (var db = new DetalleDb())
            {
                try
                {
                    /*foreach(var g in nuevo.autoresList)
                     * {
                     *   db.Entry(g).State = System.Data.Entity.EntityState.Unchanged;
                     */

                    if (Buscar(nuevo.LibrosId) == null)
                    {
                        db.libros.Add(nuevo);
                        db.SaveChanges();
                        return(true);
                    }
                    else
                    {
                        db.Entry(nuevo).State = System.Data.Entity.EntityState.Unchanged;
                        db.SaveChanges();
                        return(true);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
                return(false);
            }
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ArticuloId,Descripcion,Precio,Existencia")] Articulos articulos)
        {
            if (ModelState.IsValid)
            {
                db.Articulo.Add(articulos);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(articulos));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "ServicioId,Descripcion,Precio,Duracion")] Servicios servicios)
        {
            if (ModelState.IsValid)
            {
                db.Servicio.Add(servicios);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(servicios));
        }
コード例 #5
0
        public static bool Guardar(Actores nuevo)
        {
            bool retorno = false;

            using (var conn = new DetalleDb())
            {
                try
                {
                    conn.a.Add(nuevo);

                    /*foreach (var rep in nuevo.pelicula)
                     * {
                     *  conn.Entry(rep).State = System.Data.Entity.EntityState.Unchanged;
                     * }*/


                    conn.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
コード例 #6
0
 public static bool Eliminar(Entidades.Emails id)
 {
     using (var db = new DetalleDb())
     {
         try
         {
             db.Entry(id).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
コード例 #7
0
 public static bool Eliminar(Autores autor)
 {
     using (var db = new DetalleDb())
     {
         try
         {
             db.Entry(autor).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
         return(false);
     }
 }
コード例 #8
0
        public static Entidades.Usuarios Guardar(Entidades.Usuarios n)
        {
            bool retono = false;

            using (var db = new DetalleDb())
            {
                try
                {
                    db.usuario.Add(n);
                    db.SaveChanges();
                    return(n);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
コード例 #9
0
        public static bool Eliminar(Cotizaciones cotizacion)
        {
            bool resultado = false;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    conexion.Entry(cotizacion).State = EntityState.Deleted;
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
コード例 #10
0
        public static bool Guardar(Cotizaciones cotizacion)
        {
            bool resultado = false;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    conexion.Cotizacion.Add(cotizacion);
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
コード例 #11
0
        public static bool Guardar(Entidades.Emails n)
        {
            bool retono = false;

            using (var db = new DetalleDb())
            {
                try
                {
                    db.email.Add(n);
                    db.SaveChanges();
                    retono = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retono);
            }
        }
コード例 #12
0
ファイル: PeliculaBLL.cs プロジェクト: LeandroDuran24/Detalle
        public static bool Eliminar(Peliculas usuario)
        {
            bool retorno = false;

            using (var conn = new DetalleDb())
            {
                try
                {
                    conn.Entry(usuario).State = System.Data.Entity.EntityState.Deleted;
                    conn.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
コード例 #13
0
        public static bool Modificar(CotizacionDetalles detalle)
        {
            bool resultado = false;

            using (var conexion = new DetalleDb())
            {
                try
                {
                    conexion.Entry(detalle).State = EntityState.Modified;
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
コード例 #14
0
ファイル: PeliculaBLL.cs プロジェクト: LeandroDuran24/Detalle
 public static bool Guardar(Peliculas nuevo)
 {
     using (var guar = new DetalleDb())
     {
         try
         {
             foreach (var rep in nuevo.actor)
             {
                 guar.Entry(rep).State = System.Data.Entity.EntityState.Unchanged;
             }
             guar.p.Add(nuevo);
             guar.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
         return(false);
     }
 }