I would like to know an alternative to avoid the excessive use of IF within this code
if (paq.Lunes)
this.lu.Attributes.Add("class", "select");
if (paq.Martes)
this.ma.Attributes.Add("class", "select");
if (paq.Miercoles)
this.mi.Attributes.Add("class", "select");
if (paq.Jueves)
this.jue.Attributes.Add("class", "select");
if (paq.Viernes)
this.vie.Attributes.Add("class", "select");
if (paq.Sabado)
this.sa.Attributes.Add("class", "select");
if (paq.Domingo)
this.dom.Attributes.Add("class", "select");
if (!paq.aplicaTransporte)
this.transporte.Visible = false;
if (!paq.aplicaEntrada)
this.entrada.Visible = false;
if (!paq.aplicaGuia)
this.guia.Visible = false;
if (!paq.aplicaComida)
this.comida.Visible = false;
if (!paq.aplicaSeguro)
this.seguro.Visible = false;
if (!paq.aplicaTransporteMaritimo)
this.maritimo.Visible = false;
if (!paq.aplicaBebidasAlcoholicas)
this.alcohol.Visible = false;
This is the class
public class PaqueteTour
{
public Boolean Lunes { get; set; }
public Boolean Martes { get; set; }
public Boolean Miercoles { get; set; }
public Boolean Jueves { get; set; }
public Boolean Viernes { get; set; }
public Boolean Sabado { get; set; }
public Boolean Domingo { get; set; }
{
//
// TODO: Agregar aquí la lógica del constructor
//
precio = new preciotourlistado();
promocion = new PromoHotel();
}
}
I'm working on .NET C #, I've thought about using functions like .map
or some of those but I can not find a way to implement it, because this information comes from an API.