Ejemplo n.º 1
0
        /*
         * This method receives all the information of a Transport in the parameters. This information is saved on an object of type
         * transporte. After that the object is saved in the data base
         */

        public void RegistrarTransporte(string numeroVehiculo, string idConductor, Boolean estado)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                transporte transporte = new transporte();
                transporte.numero_vehiculo  = numeroVehiculo;
                transporte.codigo_conductor = idConductor;
                transporte.disponible       = estado;
                transporte.activo           = true;
                db.transporte.Add(transporte);
                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        /*
         * 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();
            }
        }