/* * This method receives the id of a Product in the parameters. Data base find this product with the id and * delete the register */ public void EliminarProducto(int id) { using (FerreteriaEntities db = new FerreteriaEntities()) { producto producto; producto = db.producto.Find(id); producto.activo = false; db.Entry(producto).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
/* * This method receives the id of a Transport in the parameters. Data base find this transport with the id and * delete the register */ public void EliminarTransporte(int id) { using (FerreteriaEntities db = new FerreteriaEntities()) { transporte trans; trans = db.transporte.Find(id); trans.activo = false; db.Entry(trans).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
/* * This method receives the id of a Service in the parameters. Data base find this service with the id and * delete the register */ public void EliminarServicio(int id) { using (FerreteriaEntities db = new FerreteriaEntities()) { servicio servi; servi = db.servicio.Find(id); servi.activo = false; db.Entry(servi).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
/* * This method receives all the information of a Transport in the parameters. Data base find this transport with the id and * edit the necessary information */ public void EditarTransporte(string numeroVehiculo, string idConductor, Boolean estado, bool activo, int id) { using (FerreteriaEntities db = new FerreteriaEntities()) { transporte trans = null; trans = db.transporte.Find(id); trans.numero_vehiculo = numeroVehiculo; trans.codigo_conductor = idConductor; trans.disponible = estado; trans.activo = activo; db.Entry(trans).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
/* * This method receives all the information of a Service in the parameters. Data base find this service with the id and * edit the necessary information */ public void EditarServicio(string nombre, string categoria, string descripcion, decimal precio, bool activo, int id) { using (FerreteriaEntities db = new FerreteriaEntities()) { servicio servi = null; servi = db.servicio.Find(id); servi.nombre = nombre; servi.categoria = categoria; servi.descripcion = descripcion; servi.precio = precio; servi.activo = activo; db.Entry(servi).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
/* * This method receives all the information of a Product in the parameters. Data base find this product with the id and * edit the necessary information */ public void EditarProducto(string nombre, string categoria, string descripcion, decimal precio, decimal cantidad, bool activo, int id) { using (FerreteriaEntities db = new FerreteriaEntities()) { producto producto = null; producto = db.producto.Find(id); producto.nombre = nombre; producto.categoria = categoria; producto.descripcion = descripcion; producto.precio = precio; producto.cantidad = cantidad; producto.activo = activo; db.Entry(producto).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }