public IList <Pago> ObtenerPorContrato(int idC)        //REVISAR
        {
            RepositorioInmueble  ri   = new RepositorioInmueble(configuration);
            RepositorioInquilino rinq = new RepositorioInquilino(configuration);
            IList <Pago>         res  = new List <Pago>();

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                string sql = $"SELECT Pagos.Id, ContratoId, Fecha, cn.Id, cn.InmuebleId, cn.InquilinoId, cn.FechaInicio, cn.FechaFin, cn.PrecioInmueble FROM Pagos JOIN Contratos AS cn ON Pagos.ContratoId = cn.Id WHERE ContratoId = @idC ORDER BY Pagos.Id DESC";
                //string sql = $"SELECT Id, ContratoId, Fecha FROM Pagos WHERE Estado = 1 AND ContratoId = @idC";
                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    //command.Parameters.Add("@idC", SqlDbType.Int).Value = idC;
                    command.Parameters.AddWithValue("idC", idC);
                    command.CommandType = CommandType.Text;
                    connection.Open();
                    var reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        Pago p = new Pago
                        {
                            Id         = reader.GetInt32(0),
                            ContratoId = reader.GetInt32(1),
                            Fecha      = reader.GetDateTime(2),
                            Contrato   = new Contrato
                            {
                                Id             = reader.GetInt32(3),
                                InmuebleId     = reader.GetInt32(4),
                                InquilinoId    = reader.GetInt32(5),
                                FechaInicio    = reader.GetDateTime(6),
                                FechaFin       = reader.GetDateTime(7),
                                Inmueble       = ri.ObtenerPorId(reader.GetInt32(4)),
                                Inquilino      = rinq.ObtenerPorId(reader.GetInt32(5)),
                                PrecioInmueble = reader.GetInt32(8),
                            }
                        };
                        res.Add(p);
                    }
                    connection.Close();
                }
            }
            return(res);
        }
        virtual public Pago ObtenerPorId(int id)         //REVISAR
        {
            RepositorioInmueble  ri   = new RepositorioInmueble(configuration);
            RepositorioInquilino rinq = new RepositorioInquilino(configuration);
            Pago p = null;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                string sql = $"SELECT Pagos.Id, ContratoId, Fecha, cn.Id, cn.InmuebleId, cn.InquilinoId, cn.FechaInicio, cn.FechaFin, cn.PrecioInmueble FROM Pagos JOIN Contratos AS cn ON Pagos.ContratoId = cn.Id WHERE Pagos.Id = @id";
                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    command.Parameters.Add("@id", SqlDbType.Int).Value = id;
                    command.CommandType = CommandType.Text;
                    connection.Open();
                    var reader = command.ExecuteReader();
                    if (reader.Read())
                    {
                        p = new Pago
                        {
                            Id         = reader.GetInt32(0),
                            ContratoId = reader.GetInt32(1),
                            Fecha      = reader.GetDateTime(2),
                            Contrato   = new Contrato
                            {
                                Id             = reader.GetInt32(3),
                                InmuebleId     = reader.GetInt32(4),
                                InquilinoId    = reader.GetInt32(5),
                                FechaInicio    = reader.GetDateTime(6),
                                FechaFin       = reader.GetDateTime(7),
                                Inmueble       = ri.ObtenerPorId(reader.GetInt32(4)),
                                Inquilino      = rinq.ObtenerPorId(reader.GetInt32(5)),
                                PrecioInmueble = reader.GetInt32(8)
                            }
                        };
                    }
                    connection.Close();
                }
            }
            return(p);
        }