public ActionResult ByYear(short?year) { if (!year.HasValue || year > DateTime.Now.Year) { return(this.RedirectToAction(c => c.ByYear(GetMostRecentYear()))); } var awards = DatabaseSession.Query <Award>().Where(x => x.Year == year).Fetch(x => x.Show).Fetch(x => x.Person).Fetch(x => x.AwardType).ToList(); var viewModel = new ByYearViewModel(); viewModel.Year = year.Value; var nextYear = (short)(year.Value + 1); var prevYear = (short)(year.Value - 1); viewModel.NextYearURL = this.GetURL(c => c.ByYear(nextYear)); viewModel.PreviousYearURL = this.GetURL(c => c.ByYear(prevYear)); viewModel.AwardsTable = new AwardsTableViewModel( this.Url , id => "" , awards) { CanEdit = false, //AddItemURL = this.GetURL(c => c.AddAward(personId)), }; return(View(viewModel)); }
public ActionResult ByYear(short? year) { if (!year.HasValue || year > DateTime.Now.Year) { return this.RedirectToAction(c => c.ByYear(GetMostRecentYear())); } var awards = DatabaseSession.Query<Award>().Where(x => x.Year == year).Fetch(x => x.Show).Fetch(x => x.Person).Fetch(x => x.AwardType).ToList(); var viewModel = new ByYearViewModel(); viewModel.Year = year.Value; var nextYear = (short)(year.Value + 1); var prevYear = (short)(year.Value - 1); viewModel.NextYearURL = this.GetURL(c => c.ByYear(nextYear)); viewModel.PreviousYearURL = this.GetURL(c => c.ByYear(prevYear)); viewModel.AwardsTable = new AwardsTableViewModel( this.Url , id => "" , awards) { CanEdit = false, //AddItemURL = this.GetURL(c => c.AddAward(personId)), }; return View(viewModel); }