//Metodo verifica que los datos que recibe por parametros esten
 //correctos para luego pasarcelos a DAL
 public void eliminarRepuesto(ENT.RepuestoVehiculo repuesto)
 {
     DAL.Repuesto DalRepesto = new DAL.Repuesto();
     try
     {
         if (repuesto.Id <= 0)
         {
             throw new Exception("Debes seleccionar un repuesto a eliminar");
         }
         DalRepesto.borrarRepuesto(repuesto);
         if (DalRepesto.Error)
         {
             throw new Exception("Error al eliminar el repuesto, " + DalRepesto.ErrorMsg);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        //Metodo verifica que los datos ingresados por parametros
        //esten correctos, para luego guardarlos en la db
        public void agregarRepuesto(ENT.RepuestoVehiculo repuesto)
        {
            DAL.Repuesto DalRepesto = new DAL.Repuesto();
            //try
            //{
            if (repuesto.Impuesto <= 0)
            {
                throw new Exception("No se ha seleccionado un impuesto para este repuesto");
            }
            if (repuesto.Repuesto == string.Empty)
            {
                throw new Exception("No se ha seleccionado un repuesto");
            }
            if (repuesto.Precio <= 0)
            {
                throw new Exception("No se ha seleccionado un precio para este repuesto");
            }
            if (repuesto.Id <= 0)
            {
                DalRepesto.agregarRepuesto(repuesto);
                if (DalRepesto.Error)
                {
                    throw new Exception("Error al agregar el repuesto " + DalRepesto.ErrorMsg);
                }
            }
            else
            {
                DalRepesto.editarRepuesto(repuesto);
                if (DalRepesto.Error)
                {
                    throw new Exception("Error al editar el repuesto, " + DalRepesto.ErrorMsg);
                }
            }
            //}
            //catch (Exception ex)
            //{

            //    throw ex;
            //}
        }
 //Metodo valida los datos que ingresan por parametos, que esten
 //correctos para pasarlos al DAL
 public void agregarRepuestoMarca(ENT.MarcaVehiculo marca, ENT.RepuestoVehiculo repuesto)
 {
     DAL.Repuesto DalRepesto = new DAL.Repuesto();
     try
     {
         if (marca.Id <= 0)
         {
             throw new Exception("Debes seleccionar una marca");
         }
         if (repuesto.Id <= 0)
         {
             throw new Exception("Debes seleccionar un repuesto");
         }
         DalRepesto.agregarMarcasRepuesto(marca, repuesto);
         if (DalRepesto.Error)
         {
             throw new Exception("Error al agregar la marca a este repuesto " + DalRepesto.ErrorMsg);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }