public ActionResult Admin() { var viewmodel = new CalendarAdminViewModel(baseviewmodel); viewmodel.entries = repository.GetCalendarEntries().OrderByDescending(x => x.date).ToAdminModel(); var years = repository.GetCalendarEntries() .Select(x => x.date.Year) .Distinct() .OrderBy(x => x) .Select(x => new SelectListItem() { Text = x.ToString(), Value = x.ToString() }); viewmodel.yearList = new[] { new SelectListItem() { Text = "All", Value = "" } }.Union(years); return(View(viewmodel)); }
public CalendarAdmin(BindingList <Game> games, BindingList <Goal> goals) { InitializeComponent(); DataContext = new CalendarAdminViewModel(games, goals); }