private IEnumerable <SelectListItem> FillListaDeCanchas() { var canchas = canchaBusiness.ListCanchas(); return(canchas.Select( x => new SelectListItem { Text = x.Nombre, Value = x.Id.ToString(), Selected = false })); }
public ActionResult Index() { var canchas = canchaBusiness.ListCanchas(); var viewModel = new CanchasListViewModel { List = canchas.Select(cancha => new CanchaViewModel(cancha) { PartidosEnElDia = this.canchaBusiness.CantPartidosEnFecha(cancha, DateTime.Now) }) }; return(View(viewModel)); }