コード例 #1
0
        private IEnumerable <SelectListItem> FillListaDeCanchas()
        {
            var canchas = canchaBusiness.ListCanchas();

            return(canchas.Select(
                       x => new SelectListItem
            {
                Text = x.Nombre,
                Value = x.Id.ToString(),
                Selected = false
            }));
        }
コード例 #2
0
        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));
        }