public virtual ActionResult AlbumsByYear(int year) { IEnumerable<Album> albums = _albumService.GetAlbums(year); var model = new AlbumsByYearModel { Albums = albums, Year = year }; return View(model); }
public static void RenderAlbumsByYearPartial(this HtmlHelper<AllAlbumsModel> helper) { if (helper == null) { throw new ArgumentNullException("helper"); } foreach (var groupedAlbum in helper.ViewData.Model.GroupedAlbums) { var model = new AlbumsByYearModel { Albums = groupedAlbum, Year = groupedAlbum.Key }; helper.RenderPartial(MVC.Albums.Views.AlbumsByYear, model); } }