Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "ArticuloId,Descripcion,Precio,Existencia")] Articulos articulos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(articulos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(articulos));
 }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "ServicioId,Descripcion,Precio,Duracion")] Servicios servicios)
 {
     if (ModelState.IsValid)
     {
         db.Entry(servicios).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(servicios));
 }
Exemplo n.º 5
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;
         }
     }
 }
Exemplo n.º 6
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);
     }
 }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
 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);
     }
 }