Go from BL to Web layer

0

I am doing a CRUD in ASP.NET with a database in Azure using ADO.NET, for the layers I have BL, DAL, Entities and finally the UI, I have passed from DAL to BL the update code but I do not know how pass it from BL to Vista and the previous pass it using the id but update it by parameters

Here the code of the DAL layer in the handlers section

public int editarPersonaPorID_DAL(clsPersona oPersona)
    {
        int filas;
        SqlConnection miConexion = new SqlConnection();
        SqlCommand miComando = new SqlCommand();
        clsMyConnection gestoraConexion = new clsMyConnection();
        try
        {


            miConexion = gestoraConexion.getConnection();

            miComando.CommandText = "UPDATE Personas SET Nombre=@nombrePersona, Apellidos=@apellidosPersona, Fecha=@fechaNacimiento, Telefono=@telefono, Direccion=@direccion, ID Departamento=@IDDepartamento  WHERE IDPersona=@id";

            miComando.Parameters.Add("@id", System.Data.SqlDbType.Int).Value = oPersona.idPersona;
            miComando.Parameters.Add("@nombrePersona", System.Data.SqlDbType.Int).Value = oPersona.Nombre;
            miComando.Parameters.Add("@apellidosPersona", System.Data.SqlDbType.Int).Value = oPersona.Apellidos;
            miComando.Parameters.Add("@fechaNacimiento", System.Data.SqlDbType.Int).Value = oPersona.fechaNacimiento;
            miComando.Parameters.Add("@telefono", System.Data.SqlDbType.Int).Value = oPersona.telefono;
            miComando.Parameters.Add("@direccion", System.Data.SqlDbType.Int).Value = oPersona.direccion;
            miComando.Parameters.Add("@IDDepartamento", System.Data.SqlDbType.Int).Value = oPersona.idDepartamento;
            //Si hay lineas en el lector

            miComando.Connection = miConexion;

            filas = miComando.ExecuteNonQuery();
        }
        catch (Exception e)
        {
            throw e;
        }
        return filas;
    }

And here the handler of the BL layer

public int editarPersonaPorID_BL(int id)
    {
        clsManejadoraPersona_DAL manejadoraPersona = new clsManejadoraPersona_DAL();
        int filas;
        filas = manejadoraPersona.editarPersonaPorID_DAL(oPersona:);
        return filas;
    }
    
asked by José Espinal Mateu 09.11.2018 в 21:19
source

0 answers