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); } }
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); } }
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)); }
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)); }
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; } } }
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); } }
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); }
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); } }
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); }
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); } }