Ejemplo n.º 1
0
        public virtual ActionResult AlbumsByYear(int year)
        {
            IEnumerable<Album> albums = _albumService.GetAlbums(year);

            var model = new AlbumsByYearModel
                            {
                                Albums = albums,
                                Year = year
                            };

            return View(model);
        }
Ejemplo n.º 2
0
        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);
            }
        }