Ejemplo n.º 1
0
    public static Alquiler GetTransactionAlq(int UserId, int PeliculaId)
    {
        AlquilerTableAdapter adapter = new AlquilerTableAdapter();

        Alquiler_DS.AlquilerDataTable table = adapter.ExistAlquiler(UserId, PeliculaId);
        if (table.Rows.Count == 0)
        {
            return(null);
        }
        Alquiler_DS.AlquilerRow row = table[0];
        Alquiler obj = new Alquiler()
        {
            AlquilerId     = row.AlquilerId,
            TotalPago      = row.totalPago,
            FechaAlqui     = row.fechaAlqui,
            FechaDevol     = row.fechaDevol,
            TarjetaCredito = row.tarjetaCredito,
            CodigoTarjeta  = row.codigoTarjeta,
            Estado         = row.estado,
            UserId         = row.UserId,
            PeliculaId     = row.peliculaId
        };

        return(obj);
    }
Ejemplo n.º 2
0
    public static Alquiler GetAlquilerByID(int AlquilerId)
    {
        if (AlquilerId <= 0)
        {
            throw new ArgumentException("El AlquilerId debe ser mayor a 0");
        }

        AlquilerTableAdapter adapter = new AlquilerTableAdapter();

        Alquiler_DS.AlquilerDataTable table = adapter.GetAlquilerByID(AlquilerId);

        if (table.Rows.Count == 0)
        {
            return(null);
        }
        Alquiler_DS.AlquilerRow row = table[0];
        Alquiler obj = new Alquiler()
        {
            AlquilerId     = row.AlquilerId,
            TotalPago      = row.totalPago,
            FechaAlqui     = row.fechaAlqui,
            FechaDevol     = row.fechaDevol,
            TarjetaCredito = row.tarjetaCredito,
            CodigoTarjeta  = row.codigoTarjeta,
            Estado         = row.estado,
            UserId         = row.UserId,
            PeliculaId     = row.peliculaId
        };

        return(obj);
    }